mapping - What's the Entity Framework equivalent of NHibernate's References(x => x.ResidenceCountry).Column("ResidingInCountryId")? -
i have code:
class country { public int countryid { get; set; } public string countryname { get; set; } } class employee { public int employeeid { get; set; } public string employeename { get; set; } public int residingincountryid { get; set; } public virtual country residencecountry { get; set; } }
what should put on onmodelcreating? can navigate country's countryname employee
i'm quoting directly this blog posting ian nelson, think need:
here's how you’d rename foreign key on unidirectional one-to-many relationship in fluent nhibernate:
references(x => x.audioformat).column("audioformat");
whilst in entity framework code-first, equivalent is:
hasoptional(x => x.audioformat) .withmany() .isindependent() .map(m => m.mapkey(a => a.id, "audioformat"));
Comments
Post a Comment