.Net中的键值对数据库

发布于 2024-08-02 23:58:11 字数 273 浏览 1 评论 0原文

我有一个数据库设计问题,数据库对象的属性不固定。并且应用程序用户需要随时选择向对象添加属性。

由于这无法在具有固定列数的传统数据库设计中实现,我正在考虑使用键值对设计模式 我正在寻找在 c#(.Net) 中实现它的方法。

我更喜欢使用 Mysql 作为后端数据库。

Q1。序列化对象并存储在 mysql 数据库中的最佳方法是什么? (XML、JSON 还是二进制?)

Q2。是否有具有强大的 .Net 绑定的键值对数据库引擎?

I have a database design problem , where the database object's properties are not fixed. And the application user need to have option to add propery to the object at any time.

Since this can't be implemented in traditional database design with fixed number of columns, i am thinking about using key value pair design pattern
And i am looking for ways to implement it in c#(.Net).

I prefer to use Mysql as backend database.

Q1. What is the best way to serialize object and store in mysql database ?
( XML or JSON or Binary ? )

Q2. Is there any key value pair database engine, with robust .Net Bindings ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

网名女生简单气质 2024-08-09 23:58:11

序列化会增加应用程序的性能开销,但如果您选择这样做,那么我会使用二进制序列化,因为它是最快的。查看 protobuf-net 进行序列化。

Serialization will add a performance overhead to your application, but if you go for that then I'd use binary serialization as it's the quickest. Take a look at protobuf-net for serialization.

夜未央樱花落 2024-08-09 23:58:11

如果您不需要查询/报告这些属性,我建议另存为 XML,使用某种松散耦合序列化对象,如果添加或删除属性,则不会出错。 JSON 可以由您的应用程序在提供内容时处理。

如果您确实需要使用其他数据库字段进行查询/报告,我建议您提出某种可以存储数据的数据库模式。

If you dont need to query/report on these properties, I would suggest saving as XML, serialising your objects with some kind of loose coupling that wont error if properties are added or removed. JSON can be handled by your application when serving out the content.

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

格子衫的從容 2024-08-09 23:58:11

据我所知,MySQL支持XML字段。我不确定它是否可以索引它们。

只需使用 XmlSerializer 将对象序列化为 xml然后看看 MySQL xml 函数

As far as I know, MySQL has support for XML fields. I'm not sure if it can index them though.

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

小苏打饼 2024-08-09 23:58:11

回答问题 2:

Apache CouchDB 存储 JSON。

以下是 C# 入门指南: http://wiki.apache.org/couchdb/Getting_started_with_C %23

该数据库具有 RESTful 接口,这使得它可以轻松地从任何语言使用。

In answer 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, which makes it easy to use from any language.

吻安 2024-08-09 23:58:11

您确定需要关系数据库吗?对于我的需求, db4objects 就足够了

Are you sure you need relational database? For my needs , the db4objects is enough

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文