Please let everyone know how that works out for you.  Using NHib to
drive WCF services is of interest to many people and there are very
few clear best practices at the moment.

On Apr 6, 2:11 pm, graphicsxp <[email protected]> wrote:
> Hi John
>
> I tend to agree with you, although I can see the benefits of using
> DTO's as well.  If go back to your first reply, you suggested turning
> off lazy-loading in the mapping.
> I don't think it's a good idea because some of my clients won't use
> WCF and could benefit from lazy-loading.  Therefore, how about I turn
> on/off lazy loading at DAO level ? I could have some methods which
> would request an entity using _session.get<myentity>(id) and others
> (for WCF) that would make use of ICriteria  to join on the dependent
> tables in order to load everything at once... It seems to be my
> favourite idea (at least until the next hour ;p )
>
> On 6 avr, 13:01, John Rayner <[email protected]> wrote:
>
>
>
> > This is good advice ... if you have WCF clients which are externally-
> > controlled systems.  If you control both the service and its consumer,
> > and you expect them to evolve in sync with each other, then I think
> > the choice is less clear.
>
> > On Apr 2, 4:06 pm, James Hicks <[email protected]> wrote:
>
> > > Don't expose internal types to external systems.  Use coarse grained
> > > messages and DTOs to model the external view of your system.  The small
> > > price you pay in maintaining this extra layer buys you the ability to 
> > > change
> > > your internal system without affecting the clients of the service.
>
> > > If you are insistent on exposing your entities via WCF, turn off lazy
> > > loading.  You may be able to generate your own proxies that are smart 
> > > enough
> > > to go back to the WCF service to pull down any lazy loaded collections.
>
> > > James
>
> > > On Tue, Mar 31, 2009 at 12:08 PM, graphicsxp 
> > > <[email protected]>wrote:
>
> > > > Hi,
>
> > > > I'm struggling to get WCF Service working with NHibernate.
>
> > > > I have a  Post entity which holds a collection of Publication entities
> > > > (lazy loaded). When the collection is loaded and the Post entity
> > > > returned to the client via WCF, there is an exception :
>
> > > > Type 'PublicationProxyc00e5dcd4dce4ee889643285aadb5575' cannot have
> > > > DataContractAttribute attribute Namespace set to null.
>
> > > > The type PublicationProxy was created by NHibernate but the
> > > > Publication class looks like :
>
> > > > [DataContract(Name = "Publication")]
> > > >  public class Publication : IPublication
> > > >  {
> > > >  .
> > > >  .
> > > >  .
> > > >  }
>
> > > > What can I do to workaround this issue ?- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to