hmmm what are the disadvantages?
My current position is that i'm only seeing an improvement in my speed
when i could use this.
now i'm using lazy = false on every single thing so you can imagine
the load..

On 5 feb, 06:59, Rhys C <[email protected]> wrote:
> This is an aweful idea.
> you will find out why in.... i guess 2-3 months
>
> Please dont distribute your NH objects, yeah its sounds like a cool
> thing to do, but its not.
>
> On Feb 3, 3:13 pm, Peter Derwa <[email protected]> wrote:
>
> > Hi Allan, I don't want to remove the lazy loading, i want to overwrite
> > it with a service call to do the lazy loading!
>
> > grt
>
> > On 2 feb, 14:58, "[email protected]" <[email protected]>
> > wrote:
>
> > > What you need is a data contract serializer to push data across the
> > > pipe (the example below is only for outgoing).  If it see's an
> > > uninitialized proxy, it will skip serialization on it.
>
> > > using System;
> > > using System.CodeDom;
> > > using System.Reflection;
> > > using System.Runtime.Serialization;
> > > using System.Collections.ObjectModel;
> > > using log4net;
> > > using NHibernate.Proxy;
>
> > > namespace MyNamespace.ServiceModel {
> > >     public class NhDataContractSurrogate : IDataContractSurrogate {
> > >         private static readonly ILog log = LogManager.GetLogger(typeof
> > > (NhDataContractSurrogate));
>
> > >         #region IDataContractSurrogate Members
> > >         public object GetObjectToSerialize(object obj, Type
> > > targetType) {
> > >             log.Debug("Checking object");
> > >             var proxy = obj as INHibernateProxy;
> > >             if (proxy != null) {
> > >                 log.Debug("Hibernate proxy found");
> > >                 var li = proxy.HibernateLazyInitializer;
> > >                 if (li.IsUninitialized) {
> > >                     log.Debug("Hibernate proxy is not initialized and
> > > will not be serialized");
> > >                     obj = null;
> > >                 }
> > >                 else {
> > >                     obj = li.GetImplementation();
> > >                     log.DebugFormat(
> > >                         "Hibernate proxy was initialized and has been
> > > casted to its implementation of type '{0}'",
> > >                         obj.GetType().FullName
> > >                     );
> > >                 }
> > >             }
> > >             return obj;
> > >         }
>
> > >         public object GetCustomDataToExport(Type clrType, Type
> > > dataContractType) {
> > >             return null;
> > >         }
>
> > >         public object GetCustomDataToExport(MemberInfo memberInfo,
> > > Type dataContractType) {
> > >             return null;
> > >         }
>
> > >         public Type GetDataContractType(Type type) {
> > >             return type;
> > >         }
>
> > >         public object GetDeserializedObject(object obj, Type
> > > targetType) {
> > >             return obj;
> > >         }
>
> > >         public void GetKnownCustomDataTypes(Collection<Type>
> > > customDataTypes) {
> > >         }
>
> > >         public Type GetReferencedTypeOnImport(string typeName, string
> > > typeNamespace, object customData) {
> > >             return null;
> > >         }
>
> > >         public CodeTypeDeclaration ProcessImportedType
> > > (CodeTypeDeclaration typeDeclaration, CodeCompileUnit compileUnit) {
> > >             return typeDeclaration;
> > >         }
>
> > >         #endregion
> > >     }
>
> > > }
>
> > > On Feb 2, 5:37 am, Peter Derwa <[email protected]> wrote:
>
> > > > Hey,
>
> > > > I've downloaded the new version of NHibernate and I found some
> > > > comments about the possibilities to create your own custom lazy loader
> > > > for the new NHibernate version.
> > > > Now that looks great!!! we are using a WCF Service so we are currently
> > > > working with lazy = false, and that kinda sucks big time, because when
> > > > loading a complete table with lots of relations, that will consume
> > > > quite allot of time.
>
> > > > Could someone point me into a right direction of how to do that? I was
> > > > not able to find the right article yet.
> > > > One note to keep in mind, we have multiple projects aka databases, so
> > > > in my lazy loading customization i'll have to be able to add that
> > > > project ID to create a session to the right database!
>
> > > > grt

-- 
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