Most of the attributes are here and here, but I will make a quick guide that can be useful for your conversion.
Field attributes (properties)
Specifies when a property is or is part of a key. It can be used in more than one parameter.
It also has a parameter called Column
, where it is possible to specify the order of each key.
Specifies the column name when it is different from the property name.
Specifies which property represents foreign key connection in a Model. Can be used in two cases:
In a data property, to specify which navigation property refers:
[ForeignKey("MinhaPropriedadeDeNavegacao")]
public int MinhaChaveEstrangeira { get; set; }
public virtual TabelaEstrangeira MinhaPropriedadeDeNavegacao { get; set; }
In a navigation property, to specify which data property refers:
public int MinhaChaveEstrangeira { get; set; }
[ForeignKey("MinhaChaveEstrangeira")]
public virtual TabelaEstrangeira MinhaPropriedadeDeNavegacao { get; set; }
Blurs ambiguities when a table has multiple relations 1 to N to another table.
public class Orientador
{
public int OrientadorId { get; set; }
[InverseProperty("OrientadorAntigo")]
public virtual ICollection<Aluno> AlunosAntigos { get; set; }
[InverseProperty("OrientadorNovo")]
public virtual ICollection<Aluno> AlunosNovos { get; set; }
}
public class Aluno
{
public int AlunoId { get; set; }
public int OrientadorAntigoId { get; set; }
public int OrientadorNovoId { get; set; }
public virtual Orientador OrientadorAntigo { get; set; }
public virtual Orientador OrientadorNovo { get; set; }
}
Tells the Entity Framework that a certain property does not exist in a database. It can be an auxiliary field that only appears on screen or that is used for some function in Controller.
Indicates that the field will not be populated in the application, but in the database, by some specific rule.
Accepts an enumeration as a parameter, which has the following values:
Identity
: sequential generation by the bank;
None
: is not generated by the bank, explicitly;
Computed
: generation by some database calculation, such as a Trigger insertion, for example.
Class attributes
Specifies the table name if it is different from the class name of the Model.
I intend to enrich this answer as questions and examples appear, but it is a good starting point.
https://msdn.microsoft.com/en-us/data/jj591583.aspx
– Jéf Bueno
I was going to put in an answer, but I’m sure the Gypsy will be finishing one :p
– Jéf Bueno
Hello. Stand by.
– Leonel Sanches da Silva
Awesome guys! Why didn’t I discover this community before?! haha
– Matheus Silva
Welcome and enjoy =D
– Jéf Bueno