c# - Entity Framework composite key issue -
i getting issue when trying utilize composite key in entity framework
additional information: properties look 't => new <>f__anonymoustype0 not valid. look should represent property: c#: 't => t.myproperty' vb.net: 'function(t) t.myproperty'. when specifying multiple properties utilize anonymous type: c#: 't => new { t.myproperty1, t.myproperty2 }' vb.net: 'function(t) new { t.myproperty1, t.myproperty2 }'.
the code is
// primary key this.haskey(t => new { t.id, t.id2, t.version.major, t.version.minor, t.version.revision, t.version.build });
model
public int id { get; set; } public short id2 { get; set; } private versiontype m_version; public versiontype version { { homecoming m_version; } set { setproperty(ref m_version, value, () => this.version); } } modelbuilder.complextype<versiontype>()
i believe declaring version class before property (major etc).
if so, there anyway can prepare this?
cheers
i thinking might help previous question same. http://stackoverflow.com/a/5683788/78551 see how define models , fluent api configuration.
c# entity-framework
No comments:
Post a Comment