University of Colombo, Sri Lanka  
User Name:     
Password: 

Forum
I have a project that is destined for continual growth and development over the years. ok !!!!! these questions came to my mind: 1) How should I serialize project objects to make sure that my serialization mechanism continues to work well over time? Should I implement ISerializable? 2) How hard is it to implement document versioning ? 3)How can i capture version infomation when deserializing? (C#)
Reply

Author: Guest   Posted Date: 26/09/2006
Answer1:

Thanks for your reply !!!

As I mentioned earlier, if i have two or more version software. All the files created in previous versions file should be able to handle in the last version so i want to handle version compatibility.   
I am talking about Dot net serialization and aware about those concepts. I am using Binary formatter. We can not use .net default serialization. We want to Implement ISerializable interface.  

Sample code:

public class Employee :ISerializable
{
private int version =1;

//ADD emoployee name in this list
private ArrayList employeeList;

protected TestData(SerializationInfo info,StreamingContext context)
{
this.version = info.GetInt32("version");
this.name = info.GetString("list");
}

void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("version", this.version);
info.AddValue("list", this.employeeList);
}
}


Author: Guest   Posted Date: 26/09/2006
Answer2:

Above code, I can not  deserialize ArrayList. It is giving exception.


Author: Kuhajeyan   Posted Date: 26/09/2006
Answer3: you must explicitly create a new constructor that accepts SerializationInfo and StreamingContext parameters. the following link address your problem, http://channel9.msdn.com/wiki/default.aspx/GuidanceLibrary.ChooseBasicTypes

Author: Kuhajeyan   Posted Date: 25/09/2006
Answer4: why do you want to serialize your project objects, while you are using cvs? would you be able to clear your purpose? i guess your are talking .net serialization. .NET objects are serialized to a stream. you can choose between binary or SOAP formatting, with stream you can attach the version of your objects. In .net serialization can simply be done with using attributes. you have to declare your class with [Serializable] attribute. http://www.codeguru.com/Csharp/Csharp/cs_syntax/serialization/article.php/c7201/


© 2002-2026 UOC Tamil. All Rights Reserved. Facebook