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 7871343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:52:32+00:00 2026-06-03T01:52:32+00:00

My MassTransit saga has only one field that will not map correctly. It is

  • 0

My MassTransit saga has only one field that will not map correctly. It is –

    public virtual IDictionary<string, string> Rows
    {
        get { return _rows; }
        set { _rows = value; }
    }

I’ve tried mapping it a couple ways –

    publich ProjCTSagaMap() // ctor for my ClassMap subclass
    {
        /*HasMany(x => x.Rows)
            .AsMap("ProjectNumber")
            .KeyColumns.Add("Row", mapping => mapping.Name("Row").SqlType("nvarchar").Not.Nullable())
            .Cascade.AllDeleteOrphan()
            .Table("ProjCtSagaRow");*/

        HasMany(x => x.Rows)
            .Table("ProjCtSagaRow")
            .KeyColumn("CorrelationId")
            .Element("Row")
            .AsMap("ProjectNumber")
            .Inverse();
    }

And I’ve written a unit test to test the mapping –

    [Test] public void ProjCtSagaMapTest()
    {
        using (var session = Utility.CreateSession<ProjCtSaga, ProjCtSagaMap>())
        {
            new PersistenceSpecification<ProjCtSaga>(session)
                .CheckReference(
                    i => i.Rows,
                    new Dictionary<string, string> { { "key", "value" } },
                    new DictionaryComparer<string, string>())
                .VerifyTheMappings();
        }

I’m not sure where the problem actually lies, in the mapping, or in the test. The actual error in the unit test is –

NHibernate.MappingException occurred
  Message=No persister for: System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
  Source=NHibernate
  StackTrace:
       at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName)
       at NHibernate.Impl.SessionImpl.GetEntityPersister(String entityName, Object obj)
       at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
       at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
       at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
       at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)
       at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)
       at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
       at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)
       at NHibernate.Impl.SessionImpl.Save(Object obj)
       at FluentNHibernate.Testing.PersistenceSpecification`1.TransactionalSave(Object propertyValue) in d:\Builds\FluentNH\src\FluentNHibernate\Testing\PersistenceSpecification.cs:line 79
  InnerException: 

Can someone explain how to map an IDictionary with a ClassMap and test that mapping with PersistenceSpecification…VerifyMappings()?

PS – The version of FluentNHibernate is 1.3.0.717, and NHibernate version is 3.2.0.4000. I did have to compile it locally for one minor and unrelated change.

Thank you!


Here’s the rest of the error that I’m getting now –

System.FormatException : Failed to convert parameter value from a String to a Int32.
  ----> System.FormatException : Input string was not in a correct format.
at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
at System.Data.SqlClient.SqlParameter.GetCoercedValue()
at System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)
at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters)
at System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, ref _SqlRPC rpc)
at System.Data.SqlClient.SqlCommand.AddBatchCommand(String commandText, SqlParameterCollection parameters, CommandType cmdType)
at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()
at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoTransaction.Commit()
at FluentNHibernate.Testing.PersistenceSpecification`1.TransactionalSave(Object propertyValue) in d:\Builds\FluentNH\src\FluentNHibernate\Testing\PersistenceSpecification.cs: line 80
at FluentNHibernate.Testing.PersistenceSpecification`1.VerifyTheMappings(T first) in d:\Builds\FluentNH\src\FluentNHibernate\Testing\PersistenceSpecification.cs: line 52
at Appalappa.Tests.ProjCtTests.ProjCtSagaMapTest() in ProjCtTests.cs: line 32
--FormatException
at System.Number.StringToNumber(String str, NumberStyles options, ref NumberBuffer number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
  • 1 1 Answer
  • 0 Views
  • 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-06-03T01:52:34+00:00Added an answer on June 3, 2026 at 1:52 am

    get rid of .Inverse(); since the element can not maintain the backreference, it is a string.

    CheckReference is for References but you have a collection. Use CheckEnumerable or CheckList

    Update: this works for me

    .CheckComponentList(p => p.Rows, 
                        new[] { new KeyValuePair<string, string>("1", "2") }, 
                        (p, item) => p.Rows.Add(item));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there anything built into MassTransit that can help manage the queues? I'm specifically
I´m playing with MassTransit with a simple example and I don´t know what I´m
I've been using MassTransit for handling e-mail messages. Using this code: http://meandaspnet.blogspot.com/2009/10/how-to-binary-serialize-mailmessage-for.html I'm able
I've implemented a simple publisher/consumer set with MassTransit, and I want to have the
I keep getting the following error when trying to build the masstransit source from
After reading through the pub/sub project sample in MassTransit, it left me scratching my
I have a simple console application using MassTransit. My bus is configured to use
Imagine that we have stuff we want done in the system and sometimes exceptions
I'm trying to send a message with MassTransit over MSMQ. The message contains two
I'm looking for a starting point and I know my solution has to incorporate

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.