I think my design is so odd to you that I'm going to simplify
further. One major question I have is how to implement explicit
interface implementations. My entity must implement two interfaces
with the same name in order to interact with the rest of the domain
for which the design is not up to me. I must persist all of the
relevant data. Here is my updated domain and skeletal mapping.
Please recommend how you were persist the "Foo" properties using
NHibernate, however seems best to you.
public interface IFoo1
{
string Foo
{
get;
set;
}
}
public interface IFoo2
{
string Foo
{
get;
set;
}
}
public class ConcreteFoo : IFoo1, IFoo2
{
public virtual int Id
{
get;
set;
}
string IFoo1.Foo
{
get;
set;
}
string IFoo2.Foo
{
get;
set;
}
}
<?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>
</class>
</hibernate-mapping>
[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();
((IFoo1)foo).Foo = "foo";
session.Save(foo);
}
}
}
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---