How to save complex data to file/disk?

I am working on a side project for a small business owner (my father) and part of the requirements for the application include saving customer and job related data in a way that it can easily be backed up and/or restored on demand.

I am familiar with how to save data to a flat file, and I am familiar with how to save data to a database. What I feel like I am missing is what are “typical” strategies for saving data such as I described above to a file?

For example I noticed Quickbooks has their own file format that encapsulates an entire “business” in one file that can easily be backed up and/or used for restoration. (Briefly) How is that accomplished?

I have come across integrated databases such as sqlExpress and am left wondering if this is how end user applications typically manage data or if it is something else entirely.

In short, how can I encapsulate a large amount of complex data into a single file either of a simple data type (i.e. .DAT/.TXT) or possibly a custom file format?

EDIT: As an added bit of information I would like to avoid having to install a stand-alone RDBMS in order to save data to a database.

6

Building on Franck’s comment, you can use a DataSet to save to XML.

Writing DataSet Contents as XML Data

System.IO.StreamWriter xmlSW = new System.IO.StreamWriter("Customers.xml");

// This example assumes you have a custom dataset called ds holding customer data
ds.WriteXml(xmlSW, XmlWriteMode.WriteSchema);

xmlSW.Close();

This will produce an XML file called Customers.xml in your current directory that is a serialized version of your DataSet.

You will also need to know how to load that data back into your objects…
Loading a DataSet from XML

// Load the dataset from a file called input.xml
DataSet ds = new DataSet();
ds.ReadXml("Customers.xml", XmlReadMode.ReadSchema);

Depending on what kind of requirements you have for the application you’re trying to build. (Maybe if you are a litle more specific I can help you more, otherwise is a too generic question).

There’s many ways of saving complex data. For example, and naming only a few ways to do it, you can use a small database like SQL Compact or SQLite, or you can just use a normal file to save information. A csv file, a xml file or a json file to store date. There are many ways to do it, it all depends on what you are trying to save.
Is the amount of information big? Is the data somehow confidential? In every one of the refered examples you can chose the format that suits you better.

regards

I am on mobile so bear with me.

This is a basic walk through of object serialization.

I think that there are pros and cons to either solution. You have to weigh them out and decide which is right for you, but I would go with a database. I would say my reasoning is quite arbitrary but this is exactly the purpose of a database. However…

If I were going to use object serialization and save to a file, and I wanted the single file approach, I would save everything in a big singleton. I’m not a expert though.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật