Thank you very much for your answers, you've been very helpful and to the point.
I will consider the solutions described and see what fits best. On Sep 29, 5:07 pm, Miguel <[email protected]> wrote: > For apps where you don't control both ends of the solution (e.g. SOA > style of apps) I'd suggest to go the DTO path, however, if you contorl > both ends you might want to share the business logic in your NH > objects. You could sitll do this with DTOs just for the transfer, and > convert them back to your rich objects in the client side. This is a > clean approach, specially to don't mix your busines objects with > serialization concerns, but if you don't mind not taking a purist > approach, then you might want to save an extra mapping layer and > directly serialize your NH objects. > > I've faced a couple of problems when doing this directly. Iesi > Collections are generally no serialization friendly and you would have > to disable lazy loading to avoid getting proxy objects, which again, > have some troybles getting serialized (at least the ones created by > castle.bytecode, I'm not sure about linfu). > > Another good option, would be to expose your NH Domain Context using > Astoria. You can do LINQ Queries over the Web. Isn't SOAP, but it > works (it's actually better (in some way)). > > You might want to read this about ADO.NET DataServices > (Astoria)http://wildermuth.com/2008/07/21/NHibernate_LINQ_with_ADO_NET_Data_Se... > Also Ayende mentions some architectural issues with this approach that > are worth > considering:http://ayende.com/Blog/archive/2008/07/21/ADO.Net-Data-Services-with-... > > Also Pete Brown (as well as many others) mentioend about assembly > sharing, which is a really common technique for Silverligth > Applications, which are essentially disconnected, but we usually > control both ends, so sharing the logic makes > sense.http://community.irritatedvowel.com/blogs/pete_browns_blog/archive/20... > > Keep in mind that altough sharing logic it's a good thing, it doesn't > necessarily mean that serializing your NH Objects is the best > approach. > > On Sep 29, 3:30 pm, Chris Geihsler <[email protected]> wrote: > > > Many people who use NHibernate in a distributed (and non web-based) > > application have a layer of DTO objects that carry messages between > > the service layer and client application. In other words, neither > > NHibernate nor the domain objects that it maps to the database are > > directly available to the client. So, in the case of your query, you > > would create a DTO object that contains all the different parameters > > of that query and then map it to a criteria query on the server side. > > Then, the result set would be mapped from the domain objects that > > NHibernate hydrated to a set of result DTOs that only contain the > > fields needed by the client. > > > It sounds like a lot of work, but it actually isn't that bad (check > > outhttp://www.codeplex.com/AutoMapper) and it provides a nice layer > > of abstraction between your client and domain model. > > > Hope that clears it up. > > > -cg > > > On Sep 28, 5:43 am, Cascader <[email protected]> wrote: > > > > Hello all. > > > > I'm considering to use NH in a distributed application with a fat .Net > > > client communicating with the application layer via Web Services. I > > > was hoping to use NH on the application + database layer, having the > > > mapped classes travel over the web in SOAP messages. The first issue I > > > can think of is queries! The client must of course be able to issue > > > queries against the application server. The first approach was to try > > > to serialize ICriteria / IQuery objects from the client and get back > > > the results, but those objects can't be serialized (no parameter-less > > > ctor). I've tried several approaches to no success. I hope I'm not the > > > first to use NH in a distributed application (web services or > > > remoting) so could anyone point me to the right direction? What should > > > be serialized and transferred to the server in order to issue a query? > > > > Thanks in advance.- 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 -~----------~----~----~----~------~----~------~--~---
