通过实体框架进行备份和恢复
我正在使用一个 SQL Server 数据库,该数据库包含大约 50 个表以及这些表之间的大量关系。我已经编写了一个备份和恢复函数,它将从模型中检索所有数据,将其导出到 XML,然后可以将其再次导入到干净的数据库中。但是,当实体模型发生一些重大结构变化时,维护这种导入/导出是一项艰巨的工作。我想要一个更动态的解决方案。
是否有更动态的解决方案来从实体模型导出数据并将其再次导入到干净的数据库中?
哦,在我忘记之前......我无法直接访问数据库本身,而不是它的连接。我得到的和我能使用的就是这个实体框架对象......
I'm working with an SQL Server database with about 50 tables and plenty of relationships between those tables. I have already written a backup and restore function which will retrieve all data from the model, export it to XML which it could then import again into a clean database. But maintaining this import/export is a lot of work when there are some major structural changes to the entity model. I want a more dynamic solution.
Is there a more dynamic solution to export data from an entity model and to import it back again into a clean database?
Oh, before I forget... I don't have direct access to the database itself, not it's connection. All I get and all I can use is this entity framework object...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会将其传递给您的服务器支持团队。对于应用程序开发人员来说,必须担心数据备份/恢复似乎有点奇怪。
I would be passing this back to your server support team. Seems a bit strange for an app developer to have to worry about data backup/restore.
您是否尝试过 SQL Server发布向导?它创建了一个漂亮的格式化 SQL 文件,可以在应用程序之间轻松移动,我还使用(使用一些基于正则表达式的搜索和替换)将数据从 SQL Server 移动到 Oracle...
问候
Massimo
Have you tried the SQL Server Publishing Wizard? It creates a nifty formatted SQL file that can be easily moved between application, I've also also used (with some search&replace based on regular expression) to move data from SQL Server to Oracle...
Regards
Massimo