.Net value pair database

I have a problem with my database design where the properties of the database object are not fixed. And the user of the application should be able to add an object property at any time.

Since this cannot be implemented in a traditional fixed column database design, I am thinking about using the key value pair pattern AND I am looking for ways to implement it in C # (. Net).

I prefer to use Mysql as my database.

Q1. What's the best way to serialize an object and store it in a mysql database? (XML or JSON or Binary?)

Q2. Is there any underlying value database engine with reliable .Net bindings?

+2


source to share


5 answers


Serialization will add overhead to your application, but if you go for it I would use binary serialization as it is the fastest. Have a look at protobuf-net for serialization.



+1


source


If you don't need to query / report these properties, I would suggest saving as XML, serializing your objects with some loose coupling, which won't be an error if properties are added or removed. JSON can be processed by your application when serving content.



If you require a query / report with other database fields, I would suggest coming up with some kind of database schema that can store the data.

+1


source


As far as I know, MySQL supports XML fields. I'm not sure if it can index them.

Just serialize your object to xml using the XmlSerializer and then have a look at the MySQL xml functions .

0


source


In response to Q2:

Apache CouchDB stores JSON.

Here is a getting started guide for C #: http://wiki.apache.org/couchdb/Getting_started_with_C%23

The database has a RESTful interface that makes it easy to use from any language.

0


source


Are you sure you need a relational database? Db4objects is enough for my needs

0


source







All Articles