Here is a sample. A table script isn't needed because it won't get past line 16 in TestDateFixture.
*******************************************************
using System;
using Nullables;
namespace Tcc.Crm.Conversion.BusinessObjects
{
[Serializable]
public class TestDate
{
private int id;
private NullableDateTime startDate;
public TestDate()
{}
public Nullables.NullableDateTime StartDate
{
get { return this.startDate; }
set { this.startDate = value; }
}
public int Id
{
get { return this.id; }
set { this.id = value; }
}
}
}
*******************************************************
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Tcc.Crm.Conversion.BusinessObjects.TestDate, Tcc.Crm.Conversion.BusinessObjects" table="TEST_DATE">
<id name="Id" column="TEST_DATE_ID" type="Int32" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="StartDate" column= "START_DATE" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate"/>
</class>
</hibernate-mapping>
*******************************************************
using NHibernate;
using NHibernate.Cfg;
using NUnit.Framework;
using Tcc.Crm.Conversion.BusinessObjects;
namespace Tcc.Crm.Conversion.BusinessObjectsTestFixture
{
[TestFixture]
public class TestDateFixture
{
BusinessObjects.TestDate testDate;
[Test]
public void Create()
{
testDate=new TestDate();
Configuration cfg = new Configuration();
cfg.AddAssembly("Tcc.Crm.Conversion.BusinessObjects");
ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
ITransaction transaction = session.BeginTransaction();
session.Save(testDate);
transaction.Commit();
session.Close();
}
}
}
*******************************************************
TestCase 'Tcc.Crm.Conversion.BusinessObjectsTestFixture.TestDateFixture.Create' failed: NHibernate.MappingException : could not interpret type: Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate
at NHibernate.Cfg.Binder.GetTypeFromXML(XmlNode node)
at NHibernate.Cfg.Binder.BindSimpleValue(XmlNode node, SimpleValue model, Boolean isNullable, String path, Mappings mappings)
at NHibernate.Cfg.Binder.PropertiesFromXML(XmlNode node, PersistentClass model, Mappings mappings)
at NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
at NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
at NHibernate.Cfg.Configuration.Add(XmlDocument doc)
at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
c:\dotnet\tcc\crm\businessobjectstestfixture\testdatefixture.cs(16,0): at Tcc.Crm.Conversion.BusinessObjectsTestFixture.TestDateFixture.Create()
|