If I want to serialize an object I have to use [Serializable] attribute and all member variables will be written to the file. What I don't know how to do versioning e.g. if I add a new member variable (rename a variable or just remove a variable) to the object e.g. m_dRadius and then I open (deserialize) the file how can I determine that the variable was initialized during the load or not.
I know that there are version tolerant approaches and I can mark variables with [OptionalField(VersionAdded = 1)] attribute. If I open an old file the framework will ignore this optional (new variable) and it will be just zero/null. But again how can I determine if the variable is initialized by load to zero or it was ignored.
I can write the class/object version number to the stream. Use the ISerializable approach and in the constructor(SerializationInfo oInfo, StreamingContext context) method read this version number. This will exactly tell me what is the class version in the stream.
However I expected that such kind of versioning is already implemented by the streaming framework. I tried to obtain the Assembly version from the SerializationInfo but it is always set to current version not to the version which was used when the object was saved.
What is the preferred approach? I found a lot of articles on the net, but I could not find a good solution for this...
I am sure you will be able to find the MCSD from that
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
This seems to me like a , eh, quite ridiculous question, but I´m absolutely unable to find out where to get the Project Template for Entity Framework in VS2012...trying to do so since round about 50 minutes
What I can do is rightclick under my webproject, select 'Data' and then add a new ADO.NET Entity data model which then will be created under my WebApp-branch...
What I want to do is to add an independent Project in the solution in order to reference it from any project within the solution...
I know this is possible; I've done it two or three times before, but I regrettably forgot how I've done that...
Can anyone please point me to the right direction??
Thanks in advance,
ok, this is a perfect example of someone failing to use google/bing/whatsoever the correct way with the correct keywords...
But just in case, someone else stumbles over my problem, here´s the solution:
The answer is – To consume an Entity model in separate projects, you have to create the model in its own project, i.e. a class library project.
You don't have to put it in a sperate project, but it's probably recommended.
There's really isn't a project template. That's why it's so difficult to find! YOu can create a Class Library project, then open the Package Manager console and type Install-Package EntityFramework. Once that's done, you've got a few ways you can go. You can find out about those from here[^].