Can user data be stored in XML files?

I have an application that is being used by multiple users (<12 users). There are less than 2000 entries, so I decided to use an XML file and save the file to \ company \ product \ p.xml.

Is this ok or am I breaking some design principles without realizing it?

EnvironmentL.net/#/winforms

Update: only 1 user, 1 thread will read or update at any given time.

+2


a source to share


5 answers


With the file, you have to make sure that no more than one thread / processes or other units of work will write at the same time or risk corruption.



SQLite can be a good solution if you need multiple concurrent writes.

+6


a source


If there are not many records to use the XML file, it may be portable.



+2


a source


Compact sql will do the job a lot better. Even just use odbc and an access database. xml files are not intended to be used as a database.

+1


a source


It's worth noting that there are some security implications for the information that goes into XML files, which are essentially clear text and can be read by any text editor. Anything that violates privacy laws, such as social security numbers, should not be stored in an XML file. Passwords should not be stored in an unencrypted XML file.

This seems obvious, but I know of at least one ASP.NET application at work where I worked where the design included a text password for the impersonation account ... Stupid.

+1


a source


Your best bet is to use some form of abstraction between the data store and your application (like an ORM). You don't have to put all the MVC code into your code, but try to piece together something that suits your needs. Then you can switch the backend from the XML file to what other people have suggested here.

+1


a source







All Articles