How to handle storage in C#/.NET
-
Hi all and happy christmas and New year... I am developing a c# windows form application in which I need to persist data, that is save data. I want to know what my choices are in this other than using SQL SERVER 2000, which i am using now but I do not want to have my users deploy SQL server on their machines so I wanna change my storage scheme. What are my choices? any links would be appreciated. If I have classes for my Objects, How can I use those classes to store my data on disk. What interfaces should i inherit and implement what if I want to do my own Indexes on data, say using HAsh tables or B-TREES THANKS FOR ANY HELP ---------------- Mohsen from IRAN
-
Hi all and happy christmas and New year... I am developing a c# windows form application in which I need to persist data, that is save data. I want to know what my choices are in this other than using SQL SERVER 2000, which i am using now but I do not want to have my users deploy SQL server on their machines so I wanna change my storage scheme. What are my choices? any links would be appreciated. If I have classes for my Objects, How can I use those classes to store my data on disk. What interfaces should i inherit and implement what if I want to do my own Indexes on data, say using HAsh tables or B-TREES THANKS FOR ANY HELP ---------------- Mohsen from IRAN
If you want your application to work only on desktop and not in a network,MS ACCESS is very good,other databases need somethings to install on user machines like SQLServer. You can import your tables and datas from SQL into ACCESS with IMPORT AND EXPORT DATA WIZARD. Access only have one file so it is easy to back up from it or move it from different machines. Mazy No sig. available now.
-
If you want your application to work only on desktop and not in a network,MS ACCESS is very good,other databases need somethings to install on user machines like SQLServer. You can import your tables and datas from SQL into ACCESS with IMPORT AND EXPORT DATA WIZARD. Access only have one file so it is easy to back up from it or move it from different machines. Mazy No sig. available now.
:cool: thanks for the reply now, what are my options if I do not wanna use access, or any database for that matter. also take into account that I need to store Persian scripts, ie unicode Thanks again Mohsen from Iran
-
Hi all and happy christmas and New year... I am developing a c# windows form application in which I need to persist data, that is save data. I want to know what my choices are in this other than using SQL SERVER 2000, which i am using now but I do not want to have my users deploy SQL server on their machines so I wanna change my storage scheme. What are my choices? any links would be appreciated. If I have classes for my Objects, How can I use those classes to store my data on disk. What interfaces should i inherit and implement what if I want to do my own Indexes on data, say using HAsh tables or B-TREES THANKS FOR ANY HELP ---------------- Mohsen from IRAN
Look into serialization in .NET, either using the
System.Runtime.Serialization
namespace elements, or theSystem.Xml.Serialization
namespace elements. The first is true serialization and can handle cirucular references, as well as be easily controlled by implementingISerializable
. All that is required to serialize a Type is attribute it with theSerializableAttribute
(put[Serializable]
on the class definition). See the .NET Framework SDK documentation for more details, or search this site for plenty of examples (or google). If a Type isn't serializable and you can't / don't want to extend it and attribute it / customize serialization, you can use anISerializationSurrogate
to serialization the Type. You can also fix-up data after serialization is completely by having your object implementIDeserializationCallback
. You can serializate to XML (SOAP) or binary with the default formatters. More might exist, or you can (though not recommended, especially without knowing the internals of serialization) implement your own formatter. XML Serialization, in contrast, using simple attributes and serialization to XML the way you define, unlike SOAP serialization above that would be pretty much unreadable to most people. XML serialization is limited however. You're not technically supposed to be able to control it as much, but you can implement the undocumentedIXmlSerializable
interface to serialization Types without XML Serialization attributes. This can serialize "prettier" documents, but doesn't have near the capabilities (like handling cirucular references).-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----