I've done some more work on this and while I've gotten a lot closer,
I'm not satisfied. First, my partial solution relies on the new
entity-name feature from the trunk. While I can live with that, it's
still not working and I just get the feeling I'm making this all too
complicated. Anyway, here's my partial solution with some a unit test
and it's results to exemplify the issue:
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
namespace MappingTests
{
public interface IFooString
{
string Foo
{
get;
set;
}
}
public interface IFooInt
{
int Foo
{
get;
set;
}
}
public class ConcreteFoo : IFooString, IFooInt
{
public virtual int Id
{
get;
set;
}
public virtual string Name
{
get;
set;
}
string IFooString.Foo
{
get;
set;
}
int IFooInt.Foo
{
get;
set;
}
}
[TestFixture]
public class FooTests
{
[Test]
public void Test()
{
Configuration cfg = new Configuration();
cfg = cfg.Configure();
ISessionFactory factory = cfg.BuildSessionFactory();
using (ISession session = factory.OpenSession())
{
new SchemaExport(cfg).Execute(false, true, false,
true, session.Connection, null);
ConcreteFoo foo = new ConcreteFoo();
foo.Name = "foo";
((IFooInt)foo).Foo = 0;
((IFooString)foo).Foo = "foo";
session.Save("IFooInt", foo);
session.Save("IFooString", foo);
}
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="MappingTests" namespace="MappingTests">
<class name="ConcreteFoo">
<id name="Id">
<generator class="identity" />
</id>
<property name="Name" />
<joined-subclass name="ConcreteFoo" entity-name="IFooInt">
<key />
<property name="Foo" />
</joined-subclass>
<joined-subclass name="ConcreteFoo" entity-name="IFooString">
<key />
<property name="Foo" />
</joined-subclass>
</class>
</hibernate-mapping>
------ Test started: Assembly: MappingTests.dll ------
NHibernate: INSERT INTO ConcreteFoo (Name) VALUES (@p0); select
last_insert_rowid(); @p0 = 'foo'
NHibernate: INSERT INTO IFooInt (Foo, IFooInt) VALUES (@p0, @p1); @p0
= 'foo', @p1 = '1'
As you can see, the result was that IFooInt was mapped properly, but
not IFooString.
Please help me figure this out. I'm pretty new to mapping so I'm
aware there are numerous ways I could be dorking this.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---