multiple tables mapping entity framework code first -


i have 3 entities roles, modules , permissions , following code first approach using ef 6

roles has roleid , modules has moduleid , permissions has permissionid keys.

now want map these 3 id values mapping table roleaccess on creating role

i able map entity icollection property , same not working above scenario.

help me out code suggestions...

the configuration trying add below..

'this mapping configuration trying `this.totable("roles"); //this.haskey(c => c.id) // .hasmany(c => c.permissions) // .withrequired() // .hasforeignkey(c => new { c.submoduleid, c.entitlementtypeid });

        this.hasmany(a => new[] {a.submodules,a.entitlementtypes})             .withmany(b => b.roles)             .map(mc =>             {                 mc.totable("permissions");                 mc.mapleftkey("roleid");                 mc.maprightkey(new[] { "submoduleid", "entitlementtypeid" });             });`' 


Comments