版本化实体的最佳实践?

发布于 2024-07-27 20:18:59 字数 533 浏览 4 评论 0原文

下午好,

我目前正处于一个用 .Net 编写并使用实体框架进行数据持久/存储的新项目的早期阶段。 所需的功能之一是能够“版本化”某些模型类型。 例如,一个模型是一个“需求”,它将具有 n 个“需求版本”,基本上具有一种返回该特定“需求”实例的历史/生命周期的方法。 在所有修订中唯一必须保持不变的是它的“ID”,其他所有内容在需求的整个生命周期中都是绝对可以更改的。

现在的问题是,我是否应该“简单地”在 Requirement >> 之间创建 1:n 关系? 要求版本? 其他功能需要是完全恢复旧状态为当前/最新状态的可能性,必须有能力进行次要和主要版本(更改)等,最后但并非最不重要的能力是创建跨版本的“基线”具有最新版本的需求集合,以便稍后返回到该特定基线并显示所有包含的需求版本?

这必须扩展到几百万个需求记录,每个需求记录都有几千个修订..这就是我特别问的原因..简单的 1:n 关系的扩展方面等。

有没有人做过类似的事情,也许是一些关于版本控制/基线等的建议/最佳实践等?

干杯& 谢谢, -约尔格

Good afternoon,

I am currently in the very early phase of a new project written in .Net and using Entity Framework for data persistence/storage. One of the features required is the ability to 'version' certain model types. E.g. one model is one 'Requirement' which will have n 'Requirement Versions', basically having a way of going back in the history/lifecycle of that particular 'Requirement' instance. The only thing that has to be static across all revisions is it's 'ID', everything else is absolutely changeable throughout the requirement's lifetime.

Now the Q is, should I 'simply' create a 1:n relationship between a Requirement >> RequirementVersion? Other features need are the possibility to completely revive old states to be the current/latest one, there must be the ability to have minor and major version (changes) and such, and last but not least the ability to create a 'Baseline' across a collection of Requirements with the latest version to go back to that particular Baseline at a later point of time and displaying all of the included RequirementVersions?

This has to scale up to a couple million Requirement Records, each of them having a couple thousand revisions.. that's particularly why I am asking.. the scaling aspect of a simple 1:n relationship etc.

Has anyone done something similiar and maybe some suggestions/best practices etc regarding versioning/baselining etc?

Cheers & thanks,
-Jörg

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

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

发布评论

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

评论(1

只是一片海 2024-08-03 20:18:59

这取决于每个需求有多少数据。

如果需求有大字段(例如需求描述)。

  1. 您可能想要对字段进行版本控制,而不是需求本身。 不幸的是,似乎没有简单的方法来处理实体框架。
  2. 其他解决方案(我们为 CMS 执行此操作)是为需求和需求描述使用单独的表。 因此,您将拥有 RequirementVersions 和 RequirementDescriptionVersions。

如果需求足够小,您可以使用需求>> 要求版本。 在大多数情况下,您不会有显着的数据增长,特别是您可以利用 SQL2008 压缩。

This depends on how much data each Requirement has.

If Requirement has large fields (e.g. Requirement Description).

  1. You probably would like to version fields instead, not Requirement itself. Unfortunately, seems there is no easy way to deal with Entity Framework.
  2. Other solution (we did this for CMS) is to have separate tables for Requirement and for Requirement Description. So as result you will have RequirementVersions and RequirmentDescriptionVersions.

If Requirement is small enough you can use Requirement >> RequirementVersion. In most cases you will not have significant data grow, especially you can utilize SQL2008 compression.

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