如何在 Db4o 对象数据库中执行数据管理任务?
我是 OODBMS 系统的新手,但我正在一个新项目中使用 Db4o,它非常适合。 事情进展顺利,我真的很喜欢这个概念,但我正在努力解决与开发相关的基本数据管理任务。 我想定期清除数据库中的所有特定类型,如何在不实际在代码中编写方法然后运行我的应用程序的情况下执行此操作? 另外,我如何解决“架构”更改。 如果我更改特定类的定义,Db4o 是否会为其创建一个新的“表”,或者是否会将其识别为仅具有不同成员集的相同类型?
顺便说一句......我在 .NET 3.5
I'm new to OODBMS systems, but I'm using Db4o on a new project for which it's perfectly suited. Things are going great and I really like the concept, but I'm struggling with how to do basic data management tasks associated with development. Periodically I want to wipe out all of a certain Type in the DB, how do I do this without actually writing a method in code to do it and then running my app? Also, how do I address "schema" changes. If I change the definition of a particular class, does Db4o create a new "table" for it, or does it recognize it as the same Type with just a different set of members?
Btw...I'm in .NET 3.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通常会根据需要编写开发代码(直到应用程序能够自行处理这些问题)。 您会很高兴知道 ObjectManager 现在是免费的,因此您可能想查看一下http://developer.db4o.com/blogs/product_news/archive/2009/01/25/object-manager-enterprise -now-free-to-all-developers.aspx
应通过向新字段添加默认值来解决架构更改问题。 Db4o不会为其“创建新表”,而只是“添加新列”。 更改类定义后从数据库检索的对象将具有新属性,但它将为空 - 因此最好为其添加默认值。 这样,您的所有对象都会在第一次使用时自行排序。 删除的字段将被忽略。
I usually write development code for as long as I need it (until the application can handle those problems itself). You'll be happy to know that ObjectManager is now free so you might want' to check it out http://developer.db4o.com/blogs/product_news/archive/2009/01/25/object-manager-enterprise-now-free-to-all-developers.aspx
Schema changes should be addressed by adding default values to new fields. Db4o will not "create a new table" for it but simply "add a new column". The object you retrieve from db after you change your class definition will have the new property but it will be null - so it is a good idea to add a default value to it. This way all your objects will sort themselves on first use. Removed fields will be ignored.