c# - EntityFramework two Foreign Keys Code First Migration issue -


i have mvc project using ef6.1 , need add foreign key model. quite new field , i'm getting error when adding migration.

i have 3 tables in place (tags, content, pages) there fk between content & tags defined system created tags_content table me.

pubic class content {  int id { get; set; } string title { get; set; } public virtual icollection<tag> tags { get; set; }  public static new void configure<tself>(entitytypeconfiguration<tself> configuration)         tself : content {  configuration.hasmany(o => o.tags)             .withmany(t => (icollection<tself>)t.content)             .map(c => c.totable("tags_content"));  }  }  class page : content { // extends general content }  class tag {  int id { get; set; } string name { get; set; }  // add column tags fk content or pages // purpose implement option of assigning additional page (or content) tag (the pageid null or page)  public int? pageid { get; set; } public virtual page page { get; set; }  public static new void configure<tself>(entitytypeconfiguration<tself> configuration)             tself : tag {     configuration.hasmany(a => a.content)                 .withmany(a => (icollection<tself>)a.tags)                 .map(c => c.totable("tags_content")); } } 

i failing write proper configuration defining fk. can here me? thanks.

i missing collection in definitions. finaly realized that. sorry bothering newbie question.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -