tags:

views:

109

answers:

2

Is there any way to name a column when LINQ modelling the same as the table? Such as this:

[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 don't necessarily reflect our business model naming scheme (it's a very large system which is why we do this). I've known of techniques such as using underscores and @ symbols, although I wasn't sure if this worked for things like this. It's more of a language thing.

+4  A: 
[Column(Name = 'Business')] public string BusinessCol { get; set; }
Lloyd
This is what I previously did, I was just wondering if there was an alternative.
Kezzer
+1  A: 

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

Joe Chung