This is a design question and I am confused about how to design my user object. As in most systems, user is the central part of my application and a lot of information scattered around my database points back to the user for example a user can have multiple orders, mulitple Addresses, and he may have won multiple prizes. If we want to talk about ONLY user and his basic information we can be done with ID, firstnmae, lastname etc. So I have two clear choices
- Create a light weight user object which looks like following:
public Class User
{
public int Id {get;set;}
public string FirstName {get;set;}
public string LastName {get;set;}
public string SomeMoreInformation {get;set;}
}
and get all the infromation at the other information at the run time like orders and Prizes on need basis.
OR
Design a more contained object which carries all the required information with it but is little heavy:
public Class User
{
public int Id {get;set;}
public string FirstName {get;set;}
public string LastName {get;set;}
public string SomeMoreInformation {get;set;}
public Address HomeAddress {get;set;}
public List<Prizes> Prizes {get;set;}
}
Which Does any design model align to a good design philosophy? Are there any best practices in the kind of situation that can help me make a decision?
Aucun commentaire:
Enregistrer un commentaire