EF Code first parent child mapping

This may be a duplicate qn, but i couldnt get a proper answer to this scenario. I have the following table structure:

public class File
     public int FileId { get; set; } //PK
     public int VersionID { get; set; }

     public virtual ICollection<FileLocal> FileLLocalCollection { get; set; }

public class FileLocal
     public int FileId { get; set; } //PK, FK
     public int LangID { get; set; } //PK,FK
     public string FileName { get; set; }

I have not included the third table here(Its basically LangID (PK) & LangCode ) How do i specify this mapping in fluent Api so that i can load "FileLLocalCollection" with every File objects?


The first part of your mapping can be done this way:

    .HasMany(f => f.FileLocalCollection)
    .HasForeignKey(fl => fl.FileId);

    .HasKey(fl => new {fl.FileId, fl.LangId});

And the second part depends on the way how your Lang is defined. For example if you add navigation property from FileLocal to Lang you can map it this way:

    .HasRequired(fl => fl.Lang)
    .HasForeignKey(fl => fl.LangId);

Need Your Help

Error in DIV tag scrolling

javascript html

I had created one div window which is draggable,and created one child div (with in the window div) which is scrollable.Those work individually fine,but when I am trying to scroll the inner div by

Is there a Markdown editor for Dojo

dojo markdown

Is there a good Markdown editor for Dojo?