c# - How i do for work with objects with composition -


My name is aderson and in this moment I have some questions about the structure that gives context to the display. I have a simple userbase and departmentbase in this model. There is a property of type deparmentbase in the userbase and a type of property listing in the database is Department Department When I have an example of the userbase at this time, load information about the department, but about the departments of the department About load information too. !!!

Now, when I have a list of user base, all user processes reload all users, whether it is a good practice or a better form?

I do not know if this is a better (or applicable) approach , But I sometimes make short versions of objects that I use for reference from other objects. The white version acts as a base class for the full version of the object, and it will usually contain information that will appear in the list of such objects. It often does not list the list of other items, and in any reference to the other classes, the brief version of that class will be referenced, with some unnecessary data being loaded, as well as some cases of circular references. Example:

  public square section short {public string name {get; Set; }} Public Section Department: Department Compact [Public Department] (Departments = New List & Lift; Section> Brief & gt; ();} Public IEnumerable & lt; Department> Brief & gt; Department; Get Private Set ;}} Public class UserBase {Public Department • Short section {Receive; set;}}  

There is a difference between this approach and the complete object context, with the lazy loading, that you need If there are additional data then clear If you have the UserBase example, and you need the department from UserBase of that code, then you need to Some code will need to be written in the Department object that is identified in the department object UserBase . It can be considered a negative side, but I personally But I like the fact that when this code is seen, it will be obvious when the data store has to be killed.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -