NHibernate DTO Parent child relation -
I have some entities and now some DTOs have to be made based on the use of anihirnet.
I have a service - allocation -resources where allocation is described, how the resource has been allocated for the service.
I like a DTO
service DTO -name -RASASDDO
where RessourceDTO also has a name.
Look for NHibernate projection / DTO in my example, then you can either use the property or the constructor. If I use the Constructor approach then I would have something like service DTO (name, list
), but I did not know how it was working.
Another way is to remove all services and then loop through them and press the database every time, or get a big result and then the DTO
the best way What is it? I'm going to hide all this inside a repository.
how about
public service DTO GetDTOFor ); {Var service = session Creatitivity & lt; Services & gt; (). (Add restriction AC ("id", id) .Setpet MOD ("Resource", fetchmode.eager) // Curious Load Resource. Inventory Response (); ServiceDTO (service.Name, service. Resources.ToList ()) // Copy the resource}
Comments
Post a Comment