views:

1230

answers:

1

Hi,

Assume that core project have a base entity and every plugin maybe extend the base entity

Solution structure :

   Application.Core.BaseClass
   Application.Module.SubClass (it's plug in, maybe not available)

Is any way to implement this mapping with nhibernate subclass?

Thanks and sorry for my bad english

A: 

You can add a mapping with like this:

<?xml version="1.0" encoding="utf-16"?>
<hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"" xmlns=""urn:nhibernate-mapping-2.2">
    <subclass name="SubClass" extends="BaseClass" discriminator-value="SubClass"/>
</hibernate-mapping>

And then

cfg.AddXml(xml);

You could take a look at code from a project with similar goals.

There is also the option of directly invoking the class model.

Cristian Libardo