Mapping one to (one or zero) help
Hello everybody,
I has tried googling, but I could find the answer. Could you please give me a help, many many thanks.
Here is my domain: one User mav have one, or no UserProfile
public class User : Entity
{
public User() { }
public virtual string Username { get; set; }
public virtual string FullName { get; set; }
public virtual string Password { get; set; }
public virtual string Email { get; set; }
public virtual UserStatus Status { get; set; }
public virtual UserProfile UserProfile { get; set; }
}
public class UserProfile : Entity
{
protected UserProfile() { }
public UserProfile(User user)
{
User = user;
}
public virtual DateTime Birthday { get; set; }
public virtual Gender Gender { get; set; }
public virtual string Phone { get; set; }
public virtual string PermanentAddress { get; set; }
public virtual User User { get; protected set; }
}