Hello, I'm actually upgrading an older Project with nHibernate 5.1. In this project GenericEnumMapper is used to map values (Ok, RegistrationPossible, RegistrationInProcess)
Code looks like: http://orand.blogspot.com/2006/12/generic-nhibernate-enum-string-mapping.html Everything works great when doing local in Visual Studio but not after publishing on server - on server we get: Stack Trace: [ArgumentException: Requested value 'OK' was not found.] System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult) +1185 System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) +110 NHibernate.Type.EnumStringType.GetInstance(Object code) +67 [HibernateException: Can't Parse OK as ConServiceStatus] NHibernate.Type.EnumStringType.GetInstance(Object code) +210 After comparing all settings and configs the last 2 days, I don't know where to go now. So thanks in advance for any hint --------------------------------------------------------------------------- Existing Code (modified): public class GenericEnumMapper<TEnum> : EnumStringType { /// <summary> /// Initializes a new instance of the GenericEnumMapper class. /// </summary> public GenericEnumMapper() : base(typeof(TEnum)) { } } <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="Dao.Model.ConService, Dao" table="ConService"> <id name="Id" column="Id"> <generator class="native" /> </id> ... <property name="LockDateTime" column="LockDateTime" /> <property name="LockType" column="LockType" /> <property name="Status" column="Status" type="Dao.GenericEnumMapper`1[[Dao.Model.ConServiceStatus, Dao]], Dao" not-null="true" /> </class> </hibernate-mapping> namespace Dao.Model { using System; public enum ConServiceStatus { RegistrationPossible, RegistrationInProcess, Ok } public class ConService { private int _id; .... private DateTime? _lockDateTime; private string _lockType; private PatientServiceStatus _status; public virtual DateTime? LockDateTime { get { return this._lockDateTime; } set { this._lockDateTime = value; } } public virtual string LockType { get { return this._lockType; } set { this._lockType = value; } } /// <summary> /// Status /// </summary> public virtual ConServiceStatus Status { get { return this._status; } set { this._status = value; } } } } -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
