NHibernate TypeFactory unable to instantiate Hibernate.Type.StringType

Description

I'm trying to port an ASP.NET 4/WebAPI2/NHibernate C# application to mono. I'm able to provision sessions properly but am hitting the following error on cfg.Addmapping (mappings) affter the mappings are successfully generated from source:

System.MissingMethodException
Default constructor not found for type NHibernate.Type.StringType

My implementation of GetSessionFactory is as follows:

Let me know if there's anything else you will need, or any way I can help troubleshoot this.

Environment

linux with mono

Activity

Show:

Frédéric Delaporte 
August 9, 2022 at 8:12 PM

Duplicate of #2717.

Slawomir Wlodkowski 
December 3, 2015 at 1:55 AM

I suspect this might be related.

I have a mapping-by-code fragment using NHibernateUtil.String like so:

The code above is translated by HNibernate to the XML mapping that utilizes NHibernate.Type.StringType as shown below:

This results in an exception of the Configuration.AddMapping method:

I hope this helps.

Alex Zaytsev 
June 2, 2015 at 9:51 PM
(edited)

I believe that you use this version of mapping: "m.Type<StringType>();" which is wrong. You should use "m.Type(NHibernateUtil.String);"

Fixed

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created June 2, 2015 at 8:13 PM
Updated August 9, 2022 at 8:12 PM
Resolved August 9, 2022 at 8:12 PM
Who's Looking?