[fluent-nhib] Re: PersistenceSpecification vs. Lazy Loading

2009-01-16 Thread brendanjerwin

At first I was determined to exclude ANY changes to my domain for the
sake of the ORM, so that was the reason for wanting the change to be
localized in the test framework. Of course, after your answer I
realized that 1) I've already made changes for the ORM (virtual), and
2) Equals will behave weirdly in my actual apps too since Lazy Loading
will be occurring there...

I suppose its time to introduce an EntityBase now.

PS. I still think my DuckEquals is cool though! :)

On Jan 16, 3:25 am, James Gregory  wrote:
> You shouldn't need to do a custom Equals method, you should just be able to
> override standard Equals. The proxy would be a subclass of your entity
> class, so you shouldn't have any trouble with that; overriding Equals and
> GetHashCode is generally the solution for this kind of issue.
>
> On Thu, Jan 15, 2009 at 11:17 PM, Brendan Erwin 
> wrote:
>
>
>
> > Ok, I have a possible solution to this.
>
> > (Has this not bitten anyone else?)
>
> > I wrote a DuckEquals method that behaves a lot like Equals except it
> > uses reflection to do the comparison based on property name, type, and
> > value.
>
> > Basically, if the right hand side has at least the same properties as
> > the left hand side and they are the same values then it returns true.
>
> > I have Specs (tests) written and the method written as an extension
> > method. Does this sound like a viable approach to this problem? If so,
> > where should I put the code?
>
> > On Jan 15, 2009, at 4:11 PM, Brendan Erwin wrote:
>
> > > My PersistenceSpecification is failing with this error:
>
> > >        System.ApplicationException: Expected
> > > 'Clearwave.Integration.Models.Contact.ContactRoleType' but got
> > > 'ContactRoleTypeProxyc2c0603157224549b77250fe16aca4de' for Property
> > > 'Type'
>
> > > When testing:
>
> > >       .CheckReference(x => x.Type, new ContactRoleType() { Description =
> > > "Desc", Name = "Name" })
>
> > > Is this an issue with the comparison logic in the
> > > PersistenceSpecification or am I missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~--~~~~--~~--~--~---



[fluent-nhib] Re: PersistenceSpecification vs. Lazy Loading

2009-01-16 Thread James Gregory
You shouldn't need to do a custom Equals method, you should just be able to
override standard Equals. The proxy would be a subclass of your entity
class, so you shouldn't have any trouble with that; overriding Equals and
GetHashCode is generally the solution for this kind of issue.

On Thu, Jan 15, 2009 at 11:17 PM, Brendan Erwin wrote:

>
> Ok, I have a possible solution to this.
>
> (Has this not bitten anyone else?)
>
> I wrote a DuckEquals method that behaves a lot like Equals except it
> uses reflection to do the comparison based on property name, type, and
> value.
>
> Basically, if the right hand side has at least the same properties as
> the left hand side and they are the same values then it returns true.
>
> I have Specs (tests) written and the method written as an extension
> method. Does this sound like a viable approach to this problem? If so,
> where should I put the code?
>
>
>
> On Jan 15, 2009, at 4:11 PM, Brendan Erwin wrote:
>
> > My PersistenceSpecification is failing with this error:
> >
> >System.ApplicationException: Expected
> > 'Clearwave.Integration.Models.Contact.ContactRoleType' but got
> > 'ContactRoleTypeProxyc2c0603157224549b77250fe16aca4de' for Property
> > 'Type'
> >
> > When testing:
> >
> >   .CheckReference(x => x.Type, new ContactRoleType() { Description =
> > "Desc", Name = "Name" })
> >
> >
> > Is this an issue with the comparison logic in the
> > PersistenceSpecification or am I missing something?
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~--~~~~--~~--~--~---



[fluent-nhib] Re: PersistenceSpecification vs. Lazy Loading

2009-01-15 Thread Brendan Erwin

Ok, I have a possible solution to this.

(Has this not bitten anyone else?)

I wrote a DuckEquals method that behaves a lot like Equals except it  
uses reflection to do the comparison based on property name, type, and  
value.

Basically, if the right hand side has at least the same properties as  
the left hand side and they are the same values then it returns true.

I have Specs (tests) written and the method written as an extension  
method. Does this sound like a viable approach to this problem? If so,  
where should I put the code?



On Jan 15, 2009, at 4:11 PM, Brendan Erwin wrote:

> My PersistenceSpecification is failing with this error:
>
>System.ApplicationException: Expected  
> 'Clearwave.Integration.Models.Contact.ContactRoleType' but got  
> 'ContactRoleTypeProxyc2c0603157224549b77250fe16aca4de' for Property  
> 'Type'
>
> When testing:
>
>   .CheckReference(x => x.Type, new ContactRoleType() { Description =  
> "Desc", Name = "Name" })
>
>
> Is this an issue with the comparison logic in the  
> PersistenceSpecification or am I missing something?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~--~~~~--~~--~--~---