从生产中的数据库模式以编程方式创建 EF 模型(没有 VS 生态系统)
我想在我的应用程序(产品)中利用 EF 作为 DAL。
我的应用程序中的一项功能允许在产品投入生产时创建数据库模式。
一旦在数据库中实现了此模式,我想从该数据库创建 EF 模型。此外,我应该能够将数据库架构更改(尽管非常罕见)反映到模型上。
由于生产环境缺少 Visual Studio 设置,因此排除了常规的数据库到模型方法。
代码优先方法不太符合要求,因为其代码优先迁移功能仍处于测试阶段。
我在这里有什么选择?
I'd like to leverage EF as a DAL in my application (product).
A feature in my application allows creating a database schema while the product is live in production.
I'd like to create EF model from this database, once this schema is realized in the database. Further, I should be able to reflect database schema changes (although very rare) on to the model.
The regular database to model approach is ruled out since the production environment lacks Visual Studio setup.
The code first approach doesn't quite fit the bill because of its code first migration feature is still in beta.
What are my choices here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为整个 EF 不适合您的解决方案,因为您忘记了主要问题。即使您能够在运行时定义数据库映射,您仍然需要新表应该映射的类,并且您将需要使用该新类的代码。如果您更改表中的某些内容(例如更改列的数据类型或添加列),您的现有类也必须更改。在运行时你将如何做到这一点?
I think the whole EF doesn't fit in your solution because you forget for the main problem. Even if you will be able to define database mapping in runtime you will still need classes where your new tables should be map and you will need code using that new classes. If you change something in table (for example change data type of column or add column) your existing class will have to be changed as well. How will you do that at runtime?