Question

Assume that the core project has a base entity and every plugin maybe extends the base entity.

Solution structure :

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

Is any way to implement this mapping using NHibernate subclass?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top