NH use the last release version of Castle.If you want use the Castle trunk you should compile NHibernate.ByteCode.Castle with the Castle revision you like to use.
2009/8/3 JozefSevcik <[email protected]> > > Hi all, > > Castle DynamicProxy had one ugly bug related to custom attributes of > properties of proxied class: > > http://support.castleproject.org/projects/DYNPROXY/issues/view/DYNPROXY-ISSUE-78 > > Seems that has been resolved in Castle, however I have testcase which > fails with Castle proxy factory (pass with LinFu), see testcase below. > I assume it's because NH uses older version of Castle.Core (just my > assumption). > Are there any plans to update Castle libs within NHibernate ? > > Thanks > > Failing test case(works with LinFu in NH.Tests project, switching to > CastleProxy factory makes test failing): > > Domain.cs: > namespace > NHibernate.Test.NHSpecificTest.ProxyPropertyAttributesInheritance > { > public class MyAttribute : System.Attribute > { > public string AttributeValue { get; set; } > > public MyAttribute(string attributeValue) > { > AttributeValue = attributeValue; > } > } > > public class A > { > public virtual int Id { get; set; } > > [MyAttribute("Value1")] > public virtual string Code { get; set; } > } > } > > Mappings.hbm.xml: > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > > > namespace="NHibernate.Test.NHSpecificTest.ProxyPropertyAttributesInheritance" > assembly="NHibernate.Test"> > > <class name="A" mutable="true" batch-size="50" dynamic- > update="true" dynamic-insert="true" select-before-update="false" > lazy="true"> > <id name="Id"> > <generator class="native"/> > </id> > <property name="Code"/> > </class> > </hibernate-mapping> > > Fixture.cs: > > namespace > NHibernate.Test.NHSpecificTest.ProxyPropertyAttributesInheritance > { > [TestFixture] > public class Fixture : BugTestCase > { > [Test] > public void Can_Fetch_Property_Custom_Attributes_On_Type() > { > var a = new A() { Code = "A1" }; > var attributes = a.GetType().GetProperty > ("Code").GetCustomAttributes(true); > Assert.That(attributes.Length > 0); > } > > [Test] > public void > Can_Fetch_Property_Custom_Attributes_On_Proxied_Type() > { > using (ISession s = OpenSession()) > using (ITransaction tx = s.BeginTransaction()) > { > var a = new A { Code = "A1" }; > s.SaveOrUpdate(a); > tx.Commit(); > > Assert.That(a.Id > 0); > } > > using (ISession s = OpenSession()) > { > var a = s.Load<A>(1); > var attributes = a.GetType().GetProperty > ("Code").GetCustomAttributes(true); > Assert.That(attributes.Length > 0); > } > > using (ISession s = OpenSession()) > using (ITransaction tx = s.BeginTransaction()) > { > s.Delete("from A"); > tx.Commit(); > } > } > } > } > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
