Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 689353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:19:25+00:00 2026-05-14T02:19:25+00:00

Having successfully gotten a sample program working, I’m now starting to do Real Work

  • 0

Having successfully gotten a sample program working, I’m now starting
to do Real Work with Fluent NHibernate – trying to use Automapping on my project’s class
heirarchy.

It’s a scientific instrumentation application, and the classes I’m
mapping have several properties that are arrays of floats e.g.

    private float[] _rawY; 
    public virtual float[] RawY 
    { 
        get 
        { 
            return _rawY; 
        } 
        set 
        { 
            _rawY = value; 
        } 
    } 

These arrays can contain a maximum of 500 values.

I didn’t expect Automapping to work on arrays, but tried it anyway,
with some success at first. Each array was auto mapped to a BLOB
(using SQLite), which seemed like a viable solution.

The first problem came when I tried to call SaveOrUpdate on the
objects containing the arrays – I got “No persister for float[]”
exceptions.

So my next thought was to convert all my arrays into ILists e.g.

public virtual IList<float> RawY { get; set; } 

But now I get:

NHibernate.MappingException: Association references unmapped class: System.Single 

Since Automapping can deal with lists of complex objects, it never
occured to me it would not be able to map lists of basic types. But
after doing some Googling for a solution, this seems to be the case.
Some people seem to have solved the problem, but the sample code I
saw requires more knowledge of NHibernate than I have right now – I
didn’t understand it.

Questions:

1. How can I make this work with Automapping?

2. Also, is it better to use arrays or lists for this application?

I can modify my app to use either if necessary (though I prefer
lists).

Edit:

I’ve studied the code in Mapping Collection of Strings, and I see there is test code in the source that sets up an IList of strings, e.g.

public virtual IList<string> ListOfSimpleChildren { get; set; }

[Test] 
public void CanSetAsElement() 
{ 
    new MappingTester<OneToManyTarget>() 
        .ForMapping(m => m.HasMany(x => x.ListOfSimpleChildren).Element("columnName")) 
        .Element("class/bag/element").Exists(); 
} 

so this must be possible using pure Automapping, but I’ve had zero luck getting anything to work, probably because I don’t have the requisite knowlege of manually mapping with NHibernate.

Starting to think I’m going to have to hack this (by encoding the array of floats as a single string, or creating a class that contains a single float which I then aggregate into my lists), unless someone can tell me how to do it properly.

End Edit

Here’s my CreateSessionFactory method, if that helps formulate a
reply…

    private static ISessionFactory CreateSessionFactory() 
    { 
        ISessionFactory sessionFactory = null; 


        const string autoMapExportDir = "AutoMapExport"; 
        if( !Directory.Exists(autoMapExportDir) ) 
            Directory.CreateDirectory(autoMapExportDir); 


        try 
        { 
            var autoPersistenceModel = 
                AutoMap.AssemblyOf<DlsAppOverlordExportRunData>() 
                       .Where(t => t.Namespace == "DlsAppAutomapped") 
                       .Conventions.Add( DefaultCascade.All() ) 
                ; 


            sessionFactory = Fluently.Configure() 
                .Database(SQLiteConfiguration.Standard 
                              .UsingFile(DbFile) 
                              .ShowSql() 
                         ) 
                .Mappings(m => m.AutoMappings.Add(autoPersistenceModel) 
                                             .ExportTo(autoMapExportDir) 
                         ) 
                .ExposeConfiguration(BuildSchema) 
                .BuildSessionFactory() 
                ; 
        } 
        catch (Exception e) 
        { 
            Debug.WriteLine(e); 
        } 


        return sessionFactory; 
    } 
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:19:25+00:00Added an answer on May 14, 2026 at 2:19 am

    Since I posted my question, the Fluent NHibernate team have fixed this problem.

    You can now automap ILists of C# value types (strings, ints, floats, etc).

    Just make sure you have a recent version of FNH.

    Edit

    I recently upgraded from FNH 1.0 to FNH 1.3.

    This version will also automap arrays – float[], int[], etc.

    Seems to map them as BLOBs. I assume this will be more efficient than ILists, but have not done any profiling to confirm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having successfully tried out nHibernate, I would now like to try using Fluent for
Having successfully installed opencv 2.0 with python bindings I'm starting to run into trouble
I'm trying to create an ICMP ping test program in C but am having
I can successfully extract the data from the database however am having trouble now
Is it possible to successfully use Sqlite on Android without also having to use
Starting from an existing code.google project, and having successfully pushed initial code. I created
I'm having a problem with Apple's Reachability class. I use it successfully from the
I've been using an NSTimer successfully, but am now having trouble with it. Undoubtably
Having finished and successfully published my very first iPhone app with MonoTouch, I'm now
Anybody successfully got MassTransit working with AppHarbor and CloudAMQP? I am having a bear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.