EugeneC
asked on
Serialize objects c#
I am writing a spec for a project tracking system in c#.
A project consists of many tasks, ideally these tasks need to be automatically created when the project is created in the software application.
I have a project class and a task class.
I was thinking of storing the "auto-generated" tasks in a database table "tblAutoTasks".
However I have been tasked to try and serialize these tasks as part of the project class. For example when I create a project, a generic collection is created holding these tasks. Does any of this make sense? Any pointers would be appreciated.
A project consists of many tasks, ideally these tasks need to be automatically created when the project is created in the software application.
I have a project class and a task class.
I was thinking of storing the "auto-generated" tasks in a database table "tblAutoTasks".
However I have been tasked to try and serialize these tasks as part of the project class. For example when I create a project, a generic collection is created holding these tasks. Does any of this make sense? Any pointers would be appreciated.
ASKER
Hi
Thanks for that, could you provide me with an example?
All I need is a quick example of a project class that when created serializes a set of tasks.
Thanks for that, could you provide me with an example?
All I need is a quick example of a project class that when created serializes a set of tasks.
the codeproject link comes with demo source code.
for you're case, you will have to modify the task class and add a [Serializable()] to it
for you're case, you will have to modify the task class and add a [Serializable()] to it
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot for your replies - currently I am on holiday and will be back at the end of the month - I look forward to trying your suggestions and will keep you informed.
here are some examples with explanation on serialization:
http://www.codeproject.com/csharp/objserial.asp
http://www.c-sharpcorner.com/Language/serializingObjectsinCS.asp
You can find more info on the net if you need specific stuff (like serialization to xml or other format)
You will probably need to save the resulting serializaed data either in a blob like field (if your serialized objects are huge) or an array of bytes. (varchar) in your speific case, I dont think that a task could grow big enough to cause problems if stored in a varchar.