Reputation: 309
An individual can have a "progam id code" assigned to them, but that code can be reassigned to someone else, but this code can never be assigned to more than one person. Also, it is not required to have a program id assigned.
This sounds like a 1-to-zero-or-one - how do I code this in a Code First Approach?
Upvotes: 1
Views: 74
Reputation: 218892
This will give you a One to One/One to Zero relationship
public class User
{
public int ID { set;get;}
public string Name { set;get;}
public virtual Program Program { set;get;}
}
public class Program
{
public int ID { set;get;}
public string ProgramName {set;get;}
}
That will give you a table like this where You can have a one to One/ Zero relation ship
Upvotes: 3