Entity Framework 4 code-only reference column name

Posted by Victor on Stack Overflow See other posts from Stack Overflow or by Victor
Published on 2010-04-16T11:56:44Z Indexed on 2010/04/17 0:03 UTC
Read the original article Hit count: 241

Filed under:

I created classes:

public class Country
{
  public long CountryId {get;set;}
  public string CountryName {get;set;}
}

public class Profile
{
  public long ProfileId {get;set;}
  public string ProfileName {get;set;}
  public Country Country {get;set;}
}

and configuration for Profile:

public class ProfileConfiguration : EntityConfiguration<Profile>
{
  public IlluminatiCoreProfileConfiguration()
  {
    Relation(p => p.Country);
  }
}

Then I create context and run context.CreateDatabase(). New database contains table Profiles with column Country_CountryId. How can I write configuration for changing column name to "CountryId"?

Thanks.

© Stack Overflow or respective owner

Related posts about entity-framework