Hi,
I created interfaces for my database objects which are declared as internal in the data-access dll. In the mapping files I map the concrete classes to the tables.
The mapping is correct - I can save, delete and load objects from the db.
My problem is as follows:
in a factory class I added a generic Load<T>(object id) function, which simply routes to the session's Load()-function. because outside the dll only the interfaces are visible, I pass the interface as the generic parameter to this function.
This doesn't work, I get the exception
"Unknown entity class: ICustomer"
I understand the reason for this: there's no mapping for the interface. Is there any way in the mapping file to specify that a class is implementing an interface and that this class is instantiated if you query for that interface? or any other workaround?
Here's an example:
public interface ICustomer
{
...
}
internal class CustomerImpl : ICustomer
{
...
}
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="CodeFactory.CfFaktura.Data" namespace="CodeFactory.CfFaktura.Data.Entities">
<class name="CustomerImpl" table="customer" lazy="false">
...
</class>
</hibernate-mapping>
mfg Steven
|