iusertype

How can I diagnose/fix this NHibernate.PropertyAccessException?

Given the following Fluent NHibernate maps: public class FastTrackPackageClassMap : ClassMap<FastTrackPackage> { public FastTrackPackageClassMap() { Id(x => x.Id); References(x => x.UserCreated, "UserIdCreated").Cascade.None(); References(x => x.UserSent, "UserIdSent").Nullable().Cascade.None(); H...

Constructing query against IUserType in NHibernate

How can I construct a query against an custom IUserType field in NHibernate? More specifically: I'm working on a brownfield application. I have a field in the database called "State" which contains a char representing what state a given object is in. In my code I want this to be represented as an enum so I've created an enum with a va...

NHibernate IUserType convert nullable DateTime to DB not-null value

I have legacy DB that store dates that means no-date as 9999-21-31, The column Till_Date is of type DateTime not-null="true". in the application i want to build persisted class that represent no-date as null, So i used nullable DateTime in C# //public DateTime? TillDate {get; set; } I created IUserType that knows to convert the entity ...

How do you map a DateTime property to 2 varchar columns in the database with NHibernate (Fluent)?

I'm dealing with a legacy database that has date and time fields as char(8) columns (formatted yyyyMMdd and HH:mm:ss, respectively) in some of the tables. How can i map the 2 char columns to a single .NET DateTime property? I have tried the following, but i get a "can't access setter" error of course because DateTime Date and TimeOfDay...

IQuery NHibernate - do I have to Encrypt a parameter that is an encrypted IUserType?

Situation: suppose I have a column on an entity which is encrypted in the database using IUserType: public class EncryptedStringUserType : IUserType { public object NullSafeGet(IDataReader rs, string[] names, object owner) { object r = rs[names[0]]; if (r == DBNull.Value) return null; return...

Why is Fluent NHibernate ignoring my convention?

Here is a small VS 2010 solution with a single failing test that replicates the following issue. I have a convention UserTypeConvention<MyUserType> where MyUserType : IUserType where MyUserType handles an enum type MyEnum. I have configured Fluent NHibernate thusly sessionFactory = Fluently .Configure() ...