Skip to content

Instantly share code, notes, and snippets.

@chaos95
Last active December 10, 2015 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaos95/4440197 to your computer and use it in GitHub Desktop.
Save chaos95/4440197 to your computer and use it in GitHub Desktop.
EF Collections
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
public class BigContainer
{
[Key]
public virtual int BigContainerID { get; set; }
public virtual ICollection<LittleContainer> LittleContainers { get; set; }
}
public class LittleContainer
{
[Key]
public virtual int LittleContainerID { get; set; }
public virtual BigContainer BigContainer { get; set; }
public virtual ICollection<TinyThing> TinyThings { get; set; }
}
public class TinyThing
{
[Key]
public virtual int TinyThingID { get; set; }
public virtual LittleContainer LittleContainer { get; set; }
public virtual string TinyValue { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment