当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - nhibernate webApp serializing fluently configurated object

问题描述:

Since I am begginer with nhibernate I'm going to risk to ask a repeated question.

Can someone show me on practical example serialization fluently created configuration object with one mapped entity to be simple as it can. I do not ask for mapping of entity itself, neither actual example of an entity, just nhib.configuration and serialization on disk having web app. usage in mind.

Please ask if you need more information.

Thanks

网友答案:

Sample code which demonstrates how to serialize/deserialize.

essentially it is

using(var file = File.Open(SerializedConfiguration, FileMode.Create))
{
    var bf = new BinaryFormatter();
    bf.Serialize(file, configuration);
}

Note: all own implementations of interfaces like IUserType, IConnectionProvider, ... have to be serializable.

分享给朋友:
您可能感兴趣的文章:
随机阅读: