James wrote:
>I can't remember off the top of my head whether we can detect lists of
>primitive types with the automapper;
No, you don't - throws a "No persister for System.Single" exception
for IList<float>, IIRC. Although some of the test cases imply that
you do - search for "ListOfSimpleChildren".
I really, really, REALLY think you should support this out of the box
- it's an obvious thing to want to do.
Thanks for your suggestion, but it does not work (see below). Think
I'm going to have to cut my losses and wrap my floats (and any other
primitive types) in their own classes before aggregating into lists.
I consider this a horrendous hack, but it's the only thing that's
worked so far!
In any case, in the hope that you may be able to see what's wrong,
here's what I did...
I added this to the Examples.FirstProject that comes with the Fluent
source code:
public class Product
{
...
public virtual IList<float> ListFloats { get; set; }
...
}
public class ProductOverride : IAutoMappingOverride<Product>
{
public void Override(AutoMapping<Product> mapping)
{
mapping.HasMany(x => x.ListFloats)
.Element("columnName");
}
}
And this to my CreateSessionFactory:
.UseOverridesFromAssemblyOf<ProductOverride>()
Here's what I get when I run:
Inner Exception:
{"The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has
incomplete content. List of possible elements expected: 'meta,
subselect, cache, synchronize, comment, tuplizer, id, composite-id' in
namespace 'urn:nhibernate-mapping-2.2'."}
Mapping file: - Examples.FirstProject.Entities.ProductOverride.hbm.xml
- <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
access="property" auto-import="true" default-cascade="all" default-
lazy="true">
<class xmlns="urn:nhibernate-mapping-2.2"
name="Examples.FirstProject.Entities.ProductOverride,
Examples.FirstProject, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" table="`ProductOverride`" />
</hibernate-mapping>
If you need more info, please let me know.
-Tom