I don't know that, because I even don't know why do you need a DTO. DTO is the acronym of "Data Transfer Object", should be simple, you don't want to transfer something whit nhibernate inside. Try in your service; or if you will use NHibernate to fill the DTO, in your DAL.
Sompeople use AutoMapper to Object-To-Object mapping. but.. It depends. 2009/10/19 YankeeImperialistDog <[email protected]> > > What about this? > http://ayende.com/Blog/archive/2007/12/05/Object--Object-mapping.aspx > > On Oct 19, 8:57 am, YankeeImperialistDog <[email protected]> > wrote: > > Thanks for the reply, > > Your advise is appreciated and i'm going to agree with you. My > > question now is what stratagy would you recomend for DTO that > > minimizes coding and can make use of existing entities, but not break > > sepration? I'm really trying to organize, simplify, and standardize my > > projects even if it means creating a mini framework just for DTO, i'll > > do it. > > > > On Oct 17, 7:35 pm, José F. Romaniello <[email protected]> wrote: > > > > > > > > > It is not a good place for such logic.A dto should be simpler than > that. > > > Keep nhibernate in your DAL, repositories or dao. > > > > > 2009/10/17 YankeeImperialistDog <[email protected]> > > > > > > I'm creating, or trying to create a DTO for a Person class > > > > ****** > > > > namespace KurtStack.Data.Repositories > > > > { > > > > public static class PersonDTO > > > > { > > > > public static object GetPersonDTO() > > > > { > > > > var session = > > > > IoC.Container.Resolve<INHibernateSessionProvider>() as ISession; > > > > var obj = session.CreateCriteria(typeof(Person)) > > > > .CreateAlias("FirstName", "fn") > > > > .CreateAlias("LastName", "ln"); > > > > return obj; > > > > } > > > > } > > > > } > > > > *** > > > > my problem is getting this to return to my UI via a Command object > > > > with out directly referencing INHibernateSessionProvider. Any ideas > on > > > > how to do this? > > > > > > my command object does not directly reference KurtStack.Data. > > > > > > so to get it to the UI i'd like to do something like this: > > > > GetPersonDTO. ... hrlp > > > > > > public class NewPersonCommand : ICommand > > > > { > > > > private readonly Person person; > > > > > > public static object GetPersonDTO() > > > > { > > > > object obj = GetpersonDTO(); > > > > return obj; > > > > }- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
