博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
添加Net4CollectionTypeFactory的原因
阅读量:6500 次
发布时间:2019-06-24

本文共 2328 字,大约阅读时间需要 7 分钟。

.NET4.0已经实现了该功能

 

NHibernate using .NET 4 ISet

NHibernate 4.0 (released in ) has brought us support for .NET 4 ISet<> collections, thus freeing us from the tyranny of the Iesi package. But long before that, there was a way to use .NET 4 ISet in you NHibernate 3 projects:

NHibernate.SetForNet4

SetForNet4 is a you can install into your application. Once you install it, there will be a new file with a implementation of a in your project that will support System.Collections.Generic.ISet<> instead of Iesi.Collections.Generic.ISet<>. Other than that, it is basically a copy of the original .

All you need to do after installation is to set the configuration property to the assembly qualified name of the created factory, make sure the dll with the created collection factory can be loaded (if you have it in separate project) and all will be peachy.

I had slight trouble with configuration, I have configuration spread over the XML and the code and the comment at the top said to add line to my configuration:

//add to your configuration:  //configuration.Properties[Environment.CollectionTypeFactoryClass]  // = typeof(Net4CollectionTypeFactory).AssemblyQualifiedName

Since it was integral part of the configuration (not the db dialect or something), I put it to the code

var configuration = new Configuration().Configure(); configuration.Properties[Environment.CollectionTypeFactoryClass] = typeof(Net4CollectionTypeFactory).AssemblyQualifiedName;

… and it didn’t work. I had to set the factory before I made configured from XML.

var configuration = new Configuration() .SetProperty(Environment.CollectionTypeFactoryClass, typeof(Net4CollectionTypeFactory).AssemblyQualifiedName) .Configure()

I am not exactly sure why, but I think it is because I also have assemblies with *hbm.xml mapping files specified in the XML using <mapping assembly="EntityAssembly" /> tags.

The configuration code of the bytecode provider before the mapped assemblies were processed.

Downside

It should be noted that using SetForNet4 package, you can’t use both, the Iesi and the .NET4 collections at the same time, thus you need to replace the Iesi in the whole application. Also, we have NH 4.0 now, so doing this is kind of pointless, but I did it before 4.0 and I don’t have time to upgrade to 4.0 and check that my app still works as advertised.

转载地址:http://levyo.baihongyu.com/

你可能感兴趣的文章
在html中哪一个不是链接的目标属性,HTML试题
查看>>
android otg 挂载流程,android USB OTG功能如何打开及实现
查看>>
html属性board,pin_board.html
查看>>
html定位有几种,POSITION定位有哪几种?各有什么特点?
查看>>
苹果平板可以用html么,如何将ipad苹果平板电脑中的safari浏览器禁用
查看>>
背锅侠逆袭之路
查看>>
移动互联企业级应用三大场景
查看>>
vmware的APD和PDL详细解析
查看>>
理解:思科设备上的网络地址翻译功能(NAT)功能
查看>>
演示:使用协议分析器取证IPv6的报文结构
查看>>
oracle 11gr2 rac中的4种IP解说
查看>>
为什么你找不到工作?
查看>>
SCCM 2007系列3 配置
查看>>
20 个免费的 jQuery 的工具提示插件:
查看>>
project facet java version 1.6 is not supported
查看>>
Boost.Asio的使用技巧
查看>>
CreateProcess的使用方法
查看>>
jquery(入门篇)无缝滚动
查看>>
文博项目-质量评估监测-软件
查看>>
如何学习
查看>>