I am getting an error "Cannot instantiate abstract class..." with
2.1.2.4000 where I was not with 2.1.0.1001 and could use some help
please. I am simply trying to test getting a list of the base class
that would allow me to then later filter with GetAssets().Where(a => a
is Product), etc. I did see the post regarding composite-id and this
error, but what is strange is that I was able to run this exact test
with 2.1.0.1001 on another project but now it fails. Here is the
information:
Test:
public void Can_get_list_of_assets()
{
using (UnitOfWork.Start())
{
AssetRepository repository = new AssetRepository();
var assets= repository.GetAssets();
Assert.IsNotEmpty(products);
}
}
GetAssets in repo:
public IList<AssetBase> GetAssets()
{
return base.Session
.CreateCriteria<AssetBase>()
.List<AssetBase>();
}
Mapping:
<class name="AssetBase" table="Assets" abstract="true">
<id name="_persistenceId" column="Id" access="field" unsaved-
value="00000000-0000-0000-0000-000000000000">
<generator class="guid.comb" />
</id>
<property name="Name" not-null="true" />
<property name="Description" type="StringClob">
<column name="Description" sql-type="text" />
</property>
<joined-subclass name="Product" table="Products">
<key column="Asset" />
<property name="IsPremium" not-null="true" />
<property name="Grade" not-null="true" />
<map name="_prices" access="field"
table="ProductPrices">
<key column="Product" />
<index column="PackagingSize" type="Int32" />
<element column="Price" not-null="true" />
</map>
</joined-subclass>
<joined-subclass name="Program" table="Programs">
<key column="Asset" />
<map name="_prices" access="field"
table="ProgramPrices">
<key column="Program" />
<index column="NumberOfAttendees" type="Int32"
/>
<element column="Price" not-null="true" />
</map>
</joined-subclass>
</class>
Thanks in advance,
Ryan
--
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.