1
I’m making my first system (C# ASP MVC 5) with Entity Framework and Migrations.
I have my classes mapped correctly and migrated to the Database that is SQL Server 2012.
But the question is how I can create a class that is not mapped by EF and Migrations?
I have a class of Certificates as below:
In this class that create a Status field, I thought to create a class so that it is an Enum data type, but EF insists on creating this class/table in my database. This Enum would only have the values (Active, Inactive, Expired).
I think then I don’t need to create a physical table in the bank.
What’s the best way for me to do this? Thanks in advance.
using System;
using System.ComponentModel.DataAnnotations;
namespace ControleGCD.Models
{
public class Certificado
{
[Key]
public int CertificadoId { get; set; }
public string CertificadoChave { get; set; }
public string CertificadoDescricao { get; set; }
public decimal CertificadoPreco { get; set; }
public DateTime CertificadoDtCompra { get; set; }
public DateTime CertificadoDtVencimento { get; set; }
public DateTime CertificadoDtCadastro { get; set; }
**public DateTime CertificadoStatus{ get; set; }**
}
}
"is an Enum data type", why not create an Enum?
– Barbetta