基于EAV或XML的设计数据库,用于SQL Server中具有变量特征的对象? [英] Design database based on EAV or XML for objects with variable features in SQL Server?

查看:93
本文介绍了基于EAV或XML的设计数据库,用于SQL Server中具有变量特征的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个数据库,可以存储任何对象的国王和每一类对象的不同功能。

I want to make a database that can store any king of objects and for each classes of objects different features.

给我在不同论坛上提出的一些问题解决方案是 http://en.wikipedia.org/wiki/Entity-attribute-value_model http://en.wikipedia.org/wiki/Xml 与某种存储前的验证。

Giving some of the questions i asked on different forums the solution is http://en.wikipedia.org/wiki/Entity-attribute-value_model or http://en.wikipedia.org/wiki/Xml with some kind of validation before storage.

你能给我一个以上的替代方法或一些优点或例子,这将有助于决定哪两种方法是我最好的方法案例?

Can you please give me an alternative to the ones above or some advantages or examples that would help decide which of the two methods is the best one in my case?

谢谢

更新1:
您的数据库读或写密集吗?
将会两个 - >拍卖引擎
您是否可以想象将SQL Server移到另一个平台上?
我不会移动它,我将使用WCF服务来向移动设备公开功能。
您如何计划将数据映射到应用程序?
用于DAL和WCF服务层的实体框架用于商业
人们可以通过不同于您控制的方式连接到您的数据?

UPDATE 1 : Is your db read or write intensive? will be both -> auction engine Will you ever conceivably move off SQL Server and onto another platform? I won't move it, I will use a WCF Service to expose functionality to mobile devices. How do you plan to surface your data to the application? Entity Framework for DAL and WCF Service Layer for Bussiness Will people connect to your data through means other than those you control? No

推荐答案

我将使用另一个问题的答案:

I will use my answer from another question:

EAV:


  1. 存储。如果您的价值将经常用于不同的产品,例如属性size和尺寸值经常重复的衣服,您的属性/值表将更小。同时,如果价值观是相当独特的可重复的(例如,图书属性页数的值),您将获得一个足够大的值,其中每个值都将链接到一个产品。

  2. 速度。这个方案不是项目最弱的一部分,因为这里的数据很少改变。并记住,您始终可以对数据库方案进行非规范化,以编写类似DW的解决方案。如果数据库部分也会缓慢,您可以使用缓存。

  3. 弹性这是解决方案中最强的部分。您可以轻松地添加/删除属性和值,并将值从一个属性移动到另一个属性!

  1. Storage. If your value will be used often for different products, e.g. clothes where attribute "size" and values of sizes will be repeated often, your attribute/values tables will be smaller. Meanwhile, if values will be rather unique that repeatable (e.g. values for attribute "page count" for books), you will get a big enough table with values, where every value will be linked to one product.
  2. Speed. This scheme is not weakest part of project, because here data will be changed rarely. And remember that you always can denormalize database scheme to prepare DW-like solution. You can use caching if database part will be slow too.
  3. Elasticity This is the strongest part of solution. You can easily add/remove attributes and values and ever to move values from one attribute to another!

XML存储更像是NoSQL:您将放弃数据库功能,并明智地准备您的解决方案:

XML storage is more like NoSQL: you will abdicate database functionality and you wisely prepare your solution to:


  1. 不要丢失数据完整性。

  2. 不要重写应用程序中的所有数据库功能(无关紧要)

这篇关于基于EAV或XML的设计数据库,用于SQL Server中具有变量特征的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆