Thanks I have never tried to use the MultiCriteria API, but can I get the same result from using that?
Another question - how much an overhead is to array? am I loosing what I have gained from using Future<T>. On Jul 27, 12:33 am, Davy Brion <[email protected]> wrote: > it's indeed not a lazy loading issue... the problem is that the DataContract > has one or more properties that are defined as IEnumerable<T>, but the > DataContractSerializer will choke on that if those references are actually > instances of DelayedEnumerator<T>. > > If DelayedEnumerator were public, you could use the [KnownType] attribute on > your IEnumerable properties to make sure the DataContractSerializer can deal > with DelayedEnumerator types. > > However, since there is no valid reason to make DelayedEnumerator public, i > would opt to return arrays instead of ienumerable instances in your > datacontracts, and just do a .ToArray() when you're assembling your > CatalogsForSite object. Your DataContracts shouldn't mention anything about > an implementation detail of your persistence layer IMO. > > > > On Mon, Jul 27, 2009 at 12:15 AM, mhnyborg <[email protected]> wrote: > > > I am not new to NH or the way lazy load works. > > > I work in a group of 6 developers and we have been working since new > > year with NH over WCF and Silverlight as the UI. > > > when I call var c = stypes.Any(); I can see from the unit test that NH > > is calling the databasen and that I have the corect data in all the > > DelayedEnumerator.result list. > > > So it's not a lazy load problem. > > > On Jul 26, 11:56 pm, "Erich Eichinger" <[email protected]> wrote: > > > how exactly do you expect a Future to work over a webservice with > > marshalling in between? You should rethink your context boundaries - usually > > when crossing an AppDomain boundary you should already have all data you > > need in place and ready for marshalling them. Any form of lazy evaluation > > will hardly work over the wire > > > > -Erich > > > > > -----Original Message----- > > > > From: [email protected] [mailto:[email protected]] On > > > > Behalf Of mhnyborg > > > > Sent: Sunday, July 26, 2009 11:41 PM > > > > To: nhusers > > > > Subject: [nhusers] Future<T> is not playing nice with web-services > > > > > First I love how easy it is to use Future<T> but I think it's only > > > > half baked. or put in another way only implemented for server side > > > > code that is not returning a list. > > > > > I have this code that's is returning a lot of simple catalogs for > > > > comboboxes > > > > > OperationContract] > > > > public CatalogsForSite GetCatalogsForSite() > > > > { > > > > CatalogsForSite catalogsForSite; > > > > using (var s = sessionManager.OpenSession()) > > > > { > > > > var stypes = s.CreateCriteria(typeof > > > > (ServitudeType)).Future<ServitudeType>(); > > > > var ptypes = s.CreateCriteria(typeof > > > > (ProtectionLineType)).Future<ProtectionLineType>(); > > > > var cSysTypes = s.CreateCriteria(typeof(CSys)).Future<CSys>(); > > > > var coordinatPrecissionTypes = s.CreateCriteria(typeof > > > > (CoordinatPrecissionType)).Future<CoordinatPrecissionType>(); > > > > var levelPrecissionTypes = s.CreateCriteria(typeof > > > > (LevelPrecissionType)).Future<LevelPrecissionType>(); > > > > var siteTypes = > > > > s.CreateCriteria(typeof(SiteType)).Future<SiteType> > > > > (); > > > > There is more .... > > > > > // this is done to make NH do the querys. DO this while the > > > > session > > > > is open > > > > var c = stypes.Any(); > > > > > catalogsForSite = new CatalogsForSite > > > > { > > > > StdNotes = stdNotes, > > > > SiteStatus = siteStatus, > > > > Phases = phases, > > > > ProbabilityTypes = probabilityTypes, > > > > SystemTypes = systemTypes, > > > > RevisionTypes = revisionTypes, > > > > EnvironmentClassifications = environmentClassifications, > > > > ProjectClassifications = projectClassifications, > > > > MilestoneHolidays = milestoneHolidays, > > > > There is more ... > > > > } > > > > > } > > > > > return catalogsForSite > > > > } > > > > > The problem is that Future<T> is returning > > > > NHibernate.Impl.DelayedEnumerator and that is not a type expected by > > > > the webservice. > > > > If the result on the DelayedEnumerator class was public then maybe I > > > > could use that. > > > > > Hope to get some help with this.- 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 -~----------~----~----~----~------~----~------~--~---
