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
out http://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.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to