NHibernate的SchemaUpdate安全的生产代码? [英] Is NHibernate SchemaUpdate safe in production code?

查看:126
本文介绍了NHibernate的SchemaUpdate安全的生产代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了简单起见。我在运行时使用Fluent NHibernate的Automapping和NHibernate的SchemaUpdate。每次运行Automapper都会为所有实体类创建映射,而SchemaUpdate将架构应用于现有数据库。我惊喜的发现,它对一个空的数据库也是正确的。到目前为止,在开发环境中它运行良好,并且允许我相当快速地对错误做出响应。



我的问题是,它是否足够可靠地离开生产代码。显然,每次程序在生产环境中启动时都不需要运行,但是对于增量产品更新(尽管我不打算在产品发布后对域进行任何重大更改)。 >

(也许我真正的问题应该是如何安全地使用这两个工具?)

更新



该应用程序有两个版本:独立桌面和多用户客户端/服务器。同样由于业务领域(税务软件)的性质,我每年都有一个干净的数据库开始的奢侈品。

解决方案

为了能够在生产代码中运行,生产应用程序用于连接到数据库的帐户必须具有更改数据库模式的权限。



无论NHibernate代码的质量和可靠性如何,这一方面都应该阻止你使用这种方法。


For simplicity's sake. I'm using Fluent NHibernate's Automapping combined with NHibernate's SchemaUpdate during runtime. On each run Automapper creates mappings for all entity classes and SchemaUpdate applies the schema to the existing database. I was pleasantly surprised that it works correctly against an empty database as well. It's worked fine so far in a development environment and has allowed me to respond to bugs rather quickly.

My question is whether it is reliable enough to leave in production code. Obviously it doesn't need to run every time the program starts in a production environment but it would be useful for incremental product updates (though I don't plan on making any major changes to the domain after the product ships).

(Perhaps my real question should be how safe is it to use these two tools in conjunction?)

Update

The application has two versions: a standalone desktop and a multiuser client/server. Also due to the nature of the business domain (tax software) I have the luxury of starting with a clean database each year.

解决方案

For this to be able to run in production code, the account that the production application uses to connect to your database would have to have permission to change the database schema.

That alone should deter you from this approach, irrespective of the quality/reliability of the NHibernate code.

这篇关于NHibernate的SchemaUpdate安全的生产代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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