Difference between revisions of "One to Many Model Declaration"

From Logic Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 
[[Category:MVC]]
 
[[Category:MVC]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[Category:ASP.NET]]
+
[[Category:ASP.NET]]
  
 
<pre class="brush:csharp;">
 
<pre class="brush:csharp;">

Latest revision as of 15:17, 5 April 2017


public class Model
{
  public int Id {get; set;}
  public string Name {get; set;}
  public Make Make {get; set;}

  public int MakeId {get; set;}
}
public class Make
{
  public int Id {get; set;}
  public string Name {get; set;}
  public ICollection<Model> Models {get; set;}

  public Make()
  {
     Models = new Collection<Model>();
  }
}