0

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks, but actually where this file will be saved? I dont see any save location.
SerializedConfiguration is the path to the file which should be generated. in the example it is a constant filename without path which means it will be saved in the app dir. you have to provide some meaningful path yourself

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.