LINQ model column name matches table name

Is it possible to name a column in LINQ modeling in the same way as in a table? For example:

[Table(Name="tblCC_Business")]
public class Business
{
  [Column(IsPrimaryKey=true, IsDbGenerated=false)]
  public string BusinessID { get; set; }

  [Column] public string Business { get; set; }
}

Our SQL table names do not necessarily reflect the naming scheme of the business model (this is a very large system, so we do this). I knew about methods such as using underscores and @ characters, although I was not sure if this worked for such things. It is rather a language thing.

+3
source share
2 answers
[Column(Name = 'Business')] public string BusinessCol { get; set; }
+5
source

You cannot have a member with the same name as its private type in C #.

+1
source

Source: https://habr.com/ru/post/1713743/


All Articles