Mapping NHibernate System.Type

When I map an object that has a property of type System.Type, I know that NHibernate maps it to DbType.String containing the assembly name of the assembly, and I see that the type columns in the table contain values โ€‹โ€‹of the type "TarkusSoftware.Abstract.ITask, TarkusSoftware. Abstract, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null ".

What does this mean for long-term development, what will happen when we eventually change the assembly version, for example, to 2.0.0.0? I believe that NHibernate will not be able to wet the object, since it cannot find the type with its qualified assembly name. In this case, how should I move on to displaying System.Type for future compatibility? Thanks:)

+4
source share
1 answer

This is probably correct. You can implement your own IUserType to have more control.

I just checked the source of NH, you're right. It uses only the type name and assembly, ignoring the version, etc. If interested, check the code in: TypeNameParser.Parse ()

+3
source

All Articles