NHibernate mapping system.type

When I map an entity with a System.Type type attribute, I know that NHibernate maps this to DbType.String, saves the assembly qualified name, and I can see that in the table, the type The column contains values ​​like “TarkusSoftware.Abstract”. ITask, TarkusSoftware.Abstract, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null”.

What does this mean for long-term development , What happens when we finally change the assembly version to 2.0.0.0? I think NHibernate will not be able to moisturize the object because it cannot find a type with its assembly qualified name. In this case, how should we continue to map System. Type to ensure future compatibility? Thank you:)

This may be correct. You can achieve Own IUserType for better control.

I just checked the NH source and you are right. It only uses the type and assembly name, ignores the version, etc. If you are interested, please check The following code: TypeNameParser.Parse()

When I map an entity with System.Type type properties, I know that NHibernate maps this to DbType.String and saves the assembly Qualified name, I can see in the table, the type column contains values ​​like “TarkusSoftware.Abstract”. ITask, TarkusSoftware.Abstract, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null “.

What does this mean for long-term development, and what will happen when we finally change the assembly version to 2.0.0.0? I think NHibernate will not be able to moisturize the object because it cannot find a type with its assembly-qualified name. In this case, how should we continue to map System.Type to ensure future compatibility? Thank you:)

This may be correct. You can implement your own IUserType for better control.

I Just checked the NH source, and you are right. It only uses the type and assembly name, ignoring the version, etc. If you are interested, please check the following code: TypeNameParser.Parse()

< /p>

Leave a Comment

Your email address will not be published.