Hello, This is not related to FluentNH, but directly to NH. A workaround is described in this thread http://groups.google.com/group/sharp-architecture/browse_thread/thread/ddd05f9baede023a
Em On Sat, Jun 13, 2009 at 5:38 PM, Martin Nilsson <mffmar...@gmail.com> wrote: > > CheckReference in below test fails due to that > PersistenceSpecification returns a proxy class so "obj.GetType() != > typeof(Category)" fails in Category.Equals. > I had to add a check if type starts with CategoryProxy which is not nice. > Anyone has a better solution? > > [TestFixture] > public class ProductMapTest : MappingBaseTester<Product> > { > [Test] > public void Can_save_product() > { > new PersistenceSpecification<Product>(Session) > .CheckProperty(x => x.Name, "Abc") > .CheckProperty(x => x.SKU, "136-89-010") > .CheckReference(x => x.Category, new Category{Name = "Electronics"}) > .VerifyTheMappings(); > } > } > > public class Category : IIdentity > { > ... > public override bool Equals(object obj) > { > if (ReferenceEquals(null, obj)) return false; > if (ReferenceEquals(this, obj)) return true; > ################ Note the check if type name starts with > CategoryProxy ################## > if (obj.GetType() != typeof(Category) && > !obj.GetType().Name.StartsWith(typeof(Category).Name + "Proxy")) > return false; > return Equals((Category) obj); > } > } > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---