Hi,

In order to support the mapping of classes with inheritance, NHMA
stops looking for attributes when the parent class (Test in you case)
also have the [Class] attribute.

So, you have to work around that behavior. Here are some alternatives:

--------------------------------------------------------------
// Move the [Class] attribute to a "dummy" class (this is IMO the best
solution)
class Test {      [Id] public int Id { get ; private set; }  }

[Class(NameType="Test", EntityName="Test1")]
class TestMapping: Test {     } // For mapping only!

[Class(NameType="Test", EntityName="Test2")]
class TestDummyTest: Test {     }
--------------------------------------------------------------

OR

--------------------------------------------------------------
// Duplicate the mapping inside Test (note that the attributes can be
written on an unrelated property, as long as you provide the Name)
[Class(NameType="Test", EntityName="Test1")]
class Test {      [Id] public int Id { get ; private set; }  }

[Class(NameType="Test", EntityName="Test2")]
class TestDummyTest: Test {  [Id] public string RandomProperty
{ ... }   }
--------------------------------------------------------------


HTH,
Pierre Henri.

On Aug 14, 2:42 pm, ReverseBlade <[email protected]> wrote:
> Hello,
>
> How can I use entity-name via attributes ? Even creating a dummy class
> didn't work for me. for instance
>
> [Class(NameType="Test", EntityName="Test1")]
> class Test {      [Id] public int Id { get ; private set; }  }
>
> [Class(NameType="Test", EntityName="Test2")]
> class TestDummyTest: Test {     }
>
> Here in the generated XML for 2nd case I don't see the Id mapping.
> What should I do ?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NHibernate Contrib - Development Group" 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.ar/group/nhcdevs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to