Well, of course! The property setter should be protected instead of
private... so that subclasses (proxies) can change it! My fault! :-)
Finally got it, Fabio! Thanks!

RP

On Apr 19, 12:24 pm, Fabio Maulo <[email protected]> wrote:
> el hace esto
> public virtual int Id { get; private set; }
>
> On Mon, Apr 18, 2011 at 8:40 PM, José F. Romaniello
> <[email protected]>wrote:
>
>
>
>
>
>
>
> > But the setter can be private?
> > public virtual int Id { get; set; }
>
> > 2011/4/18, Fabio Maulo <[email protected]>:
> > > and
> > > // This method work when Environment.UseProxyValidator is off
> > > System.Type clazz = persistentClass.MappedClass;
> > > foreach (Mapping.Property property in persistentClass.PropertyIterator)
> > > {
> > > MethodInfo method = property.GetGetter(clazz).Method;
> > > if (!proxyValidator.IsProxeable(method))
> > > {
> > > log.Error(
> > > string.Format("Getters of lazy classes cannot be final: {0}.{1}",
> > > persistentClass.MappedClass.FullName,
> > >               property.Name));
> > > }
> > > method = property.GetSetter(clazz).Method;
> > > if (!proxyValidator.IsProxeable(method))
> > > {
> > > log.Error(
> > > string.Format("Setters of lazy classes cannot be final: {0}.{1}",
> > > persistentClass.MappedClass.FullName,
> > >               property.Name));
> > > }
> > > }
> > > there is a clear un-sync between the validator and the proxyFactory.
> > > Thanks.
>
> > > On Mon, Apr 18, 2011 at 1:56 PM, Fabio Maulo <[email protected]>
> > wrote:
>
> > >> every things work perfect.
> > >> The "limitation"you are talking about is the same for other properties.
> > We
> > >> only forget to check the Id setter in case of:
> > >> public virtual string YourProp
> > >> {
> > >> get;
> > >> *private set;*
> > >> }
>
> > >> For other methods, than Id, you can see the exception message saying:
> > >> method set_YourProp should be 'public/protected virtual' or 'protected
> > >> internal virtual'
>
> > >> On Mon, Apr 18, 2011 at 1:45 PM, Ricardo Peres <[email protected]>
> > wrote:
>
> > >>> Fabio,
>
> > >>> You mean I can't have an id property with a private setter? Is that a
> > >>> removable limitation imposed by the new proxy generator? If so, I will
> > >>> create a JIRA issue. To me, it is interesting to not let people
> > >>> directly set values for id properties, because they normally shouldn
> > >>> be set by NHibernate.
> > >>> BTW, did you have the chance to look at the collection null issue?
>
> > >>> Many thanks!
>
> > >>> RP
>
> > >>> On Apr 18, 5:40 pm, Fabio Maulo <[email protected]> wrote:
> > >>> > The "problem" is the ProxyValidator.
> > >>> > I'll fix it thanks.
>
> > >>> > NOTE: I said you that private accessors can't be proxied.
>
> > >>> > On Mon, Apr 18, 2011 at 12:12 PM, Ricardo Peres <[email protected]>
> > >>> wrote:
> > >>> > > Yes, I have. I placed a link on all these JIRA issues:
>
> >http://cid-0450c015fc418de2.office.live.com/self.aspx/.Public/NHTest.zip.
> > >>> > > Like I said, I only want a second opinion, I may be doing something
> > >>> > > wrong.
>
> > >>> > > RP
>
> > >>> > > On Apr 18, 4:00 pm, Fabio Maulo <[email protected]> wrote:
> > >>> > > > If you have a failing test we can see it.
> > >>> > > > The embedded provider are passing all NH3.1 tests and more.
>
> > >>> > > > On Mon, Apr 18, 2011 at 11:34 AM, Ricardo Peres <
> > [email protected]>
> > >>> > > wrote:
> > >>> > > > > Fabio,
>
> > >>> > > > > The current trunk version has problems with lazy loading as
> > well:
> > >>> not
> > >>> > > > > setting id properties with private setter and setting
> > collections
> > >>> to
> > >>> > > > > null. As you know, I have created tickets for this and have
> > made
> > >>> > > > > available a demo project. This behavior does not happen with
> > the
> > >>> > > > > Castle bytecode provider as of NHibernate version 3.1 or with
> > >>> > > > > lazy
> > >>> > > > > loading disabled. As I said, I may have done something wrong,
> > >>> though,
> > >>> > > > > and the erroneous behavior can be my fault.
>
> > >>> > > > > RP
>
> > >>> > > > > On Apr 18, 3:01 pm, Fabio Maulo <[email protected]> wrote:
> > >>> > > > > > What mean "old"? how much it is old ?
> > >>> > > > > > Try the version deployed with NH3.1.0 and only change the
> > >>> signature
> > >>> > > of
> > >>> > > > > one
> > >>> > > > > > proxy-factory method.
>
> > >>> > > > > > On Mon, Apr 18, 2011 at 8:15 AM, Ricardo Peres <
> > >>> [email protected]>
> > >>> > > > > wrote:
> > >>> > > > > > > Did you try defining your entity as lazy="true"?
> > >>> > > > > > > It must be lazy in order to use lazy properties.
> > >>> > > > > > > However, I do think there's a bug with Castle bytecode
> > >>> provider,
> > >>> > > and I
> > >>> > > > > > > have submitted a JIRA issue:
> > >>>http://216.121.112.228/browse/NH-2646.
>
> > >>> > > > > > > RP
>
> > >>> > > > > > > On Apr 18, 9:45 am, kor <[email protected]> wrote:
> > >>> > > > > > > > i have a problem, probably about proxy dll conflict (i'm
> > >>> writing
> > >>> > > > > here,
> > >>> > > > > > > > not in jira, becouse i think that is not a bug, only a
> > >>> > > configuration
> > >>> > > > > > > > problem).
> > >>> > > > > > > > i'm using .net 2.0, with the version 3.1.0.4000 all
> > works,
> > >>> with
> > >>> > > the
> > >>> > > > > > > > new version (built by myself or downloaded by nhforge) i
> > >>> have a
> > >>> > > > > > > > problem when using Session.Get
> > >>> > > > > > > > for a class that has a property with lazy="true".
>
> > >>> > > > > > > > with the new nh version i have this exception
> > >>> > > > > > > > NHibernate.Exceptions.GenericADOException : could not
> > load
> > >>> an
> > >>> > > entity:
> > >>> > > > > > > > ***
> > >>> > > > > > > >   ----> System.NotSupportedException : Specified method
> > is
> > >>> not
> > >>> > > > > > > > supported.
> > >>> > > > > > > >         at
> > >>> > > NHibernate.Loader.Loader.LoadEntity(ISessionImplementor
> > >>> > > > > > > session,
> > >>> > > > > > > > Object id, IType identifierType, Object optionalObject,
> > >>> String
> > >>> > > > > > > > optionalEntityName, Object optionalIdentifier,
> > >>> IEntityPersister
> > >>> > > > > > > > persister)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor
> > >>> > > > > > > > session, Object id, Object optionalObject, Object
> > >>> optionalId)
> > >>> > > > > > > >         at
> > >>> > > NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object
> > >>> > > > > id,
> > >>> > > > > > > > Object optionalObject, ISessionImplementor session)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Persister.Entity.AbstractEntityPersister.Load(Object
> > >>> > > > > > > > id, Object optionalObject, LockMode lockMode,
> > >>> ISessionImplementor
> > >>> > > > > > > > session)
> > >>> > > > > > > >         at
>
> > NHibernate.Event.Default.DefaultLoadEventListener.LoadFromDatasource(LoadEv
> > >>> > > > > > > ent
> > >>> > > > > > > > event, IEntityPersister persister, EntityKey keyToLoad,
> > >>> LoadType
> > >>> > > > > > > > options)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Event.Default.DefaultLoadEventListener.DoLoad(LoadEvent
> > >>> > > > > > > > event, IEntityPersister persister, EntityKey keyToLoad,
> > >>> LoadType
> > >>> > > > > > > > options)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent
> > >>> > > > > > > > event, IEntityPersister persister, EntityKey keyToLoad,
> > >>> LoadType
> > >>> > > > > > > > options)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Event.Default.DefaultLoadEventListener.ProxyOrLoad(LoadEvent
> > >>> > > > > > > > event, IEntityPersister persister, EntityKey keyToLoad,
> > >>> LoadType
> > >>> > > > > > > > options)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent
> > >>> > > > > > > > event, LoadType loadType)
> > >>> > > > > > > >         at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent
> > >>> event,
> > >>> > > > > LoadType
> > >>> > > > > > > > loadType)
> > >>> > > > > > > >         at NHibernate.Impl.SessionImpl.Get(String
> > >>> entityName,
> > >>> > > Object
> > >>> > > > > id)
> > >>> > > > > > > >         at NHibernate.Impl.SessionImpl.Get(Type
> > >>> > > > > > > > entityClass,
> > >>> > > Object
> > >>> > > > > id)
> > >>> > > > > > > >         at NHibernate.Impl.SessionImpl.Get[T](Object id)
> > >>> > > > > > > >         --NotSupportedException
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Proxy.AbstractProxyFactory.GetFieldInterceptionProxy(Object
> > >>> > > > > > > > instanceToWrap)
> > >>> > > > > > > >         at
> > NHibernate.Tuple.PocoInstantiator.Instantiate()
> > >>> > > > > > > >         at
> > >>> NHibernate.Tuple.PocoInstantiator.Instantiate(Object
> > >>> > > id)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Tuple.Entity.AbstractEntityTuplizer.Instantiate(Object
> > >>> > > > > > > > id)
> > >>> > > > > > > >         at
>
> > >>> NHibernate.Persister.Entity.AbstractEntityPersister.Instantiate(Object
> > >>> > > > > > > > id, EntityMode entityMode)
> > >>> > > > > > > >         at
> > >>> > > NHibernate.Impl.SessionImpl.Instantiate(IEntityPersister
> > >>> > > > > > > > persister, Object id)
> > >>> > > > > > > >         at NHibernate.Impl.SessionImpl.Instantiate(String
> > >>> clazz,
> > >>> > > > > Object
> > >>> > > > > > > id)
> > >>> > > > > > > >         at
> > >>> > > NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader
> > >>> > > > > dr,
> > >>> > > > > > > > Int32 i, ILoadable persister, EntityKey key, LockMode
> > >>> lockMode,
> > >>> > > > > String
> > >>> > > > > > > > rowIdAlias, EntityKey optionalObjectKey, Object
> > >>> optionalObject,
> > >>> > > IList
> > >>> > > > > > > > hydratedObjects, ISessionImplementor session)
> > >>> > > > > > > >         at NHibernate.Loader.Loader.GetRow(IDataReader
> > rs,
> > >>> > > > > ILoadable[]
> > >>> > > > > > > > persisters, EntityKey[] keys, Object optionalObject,
> > >>> EntityKey
> > >>> > > > > > > > optionalObjectKey, LockMode[] lockModes, IList
> > >>> hydratedObjects,
> > >>> > > > > > > > ISessionImplementor session)
> > >>> > > > > > > >         at
> > >>> > > NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader
>
> ...
>
> read more »

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