简体   繁体   English

实体框架和Dynamics导航数据库

[英]Entity Framework and a Dynamics NAV database

I'm currently working on an Intranet application project, using ASP.NET MVC 3. One of the primary requirements is that all data created with the application must be available in the clients' ERP software as well; 我目前正在使用ASP.NET MVC 3进行Intranet应用程序项目。主要要求之一是,使用该应用程序创建的所有数据也必须在客户端的ERP软件中可用。 they work with MS Dynamics NAV. 他们与MS Dynamics导航一起使用。 Accessing the data is not really a problem, as NAV uses SQL-Server as its database. 访问数据不是真正的问题,因为NAV使用SQL-Server作为其数据库。

In fact I already have a working prototype, that uses Entity Framework for data access. 实际上,我已经有一个可以使用实体框架进行数据访问的工作原型。 The main issue here is that my company also develops quite a lot of custom functionality within the ERP, and thus some of the database tables I have to read from and write to often change. 这里的主要问题是,我的公司还在ERP内开发了很多自定义功能,因此我必须读取和写入的一些数据库表经常更改。 This would not really be a problem in a usual situation, but here, each and every field in the database is marked as not null , a very annoying feature of Dynamics NAV. 在通常情况下,这实际上不是问题,但是在这里,数据库中的每个字段都标记为not null ,这是Dynamics NAV的一个非常烦人的功能。 That means that every field added to a table breaks my code, as Entity Framework tries to insert null when it doesn't know of a field. 这意味着添加到表中的每个字段都会破坏我的代码,因为Entity Framework会在不知道字段时尝试插入null。

Can any of you think of a solution that would not require regenerating the model after each change in the tables ? 你们中有谁能想到不需要在每次更改表后重新生成模型的解决方案?

Edit : Unfortunately our client still uses version 4.0 of Nav, so webservices are not an option.. I have already developed another application for them (part of a Warehouse management system which runs on mobile terminals), accessing SQL Server directly, but it was not quite the same scale. 编辑:不幸的是,我们的客户端仍然使用Nav 4.0版,因此不能选择使用Web服务。.我已经为它们开发了另一个应用程序(在移动终端上运行的Warehouse管理系统的一部分),直接访问SQL Server,但是规模不太一样。

If your requirement is to integrate with ERP like Dynamics NAV you should pass all data access through its application server. 如果您的要求是与Dynamics NAV之类的ERP集成,则应通过其应用程序服务器传递所有数据访问权限。 I think Dynamics NAV expose web services for communication with application server. 我认为Dynamics NAV公开了用于与应用程序服务器进行通信的Web服务。 Accessing its tables directly is way to disaster especially due to transactions and possible deadlocks. 直接访问其表是一种灾难,特别是由于事务和可能的死锁。 EF will make this even worse because you will not be able to tweak queries. EF会使情况变得更糟,因为您将无法调整查询。

Application integration through database requires full control over SQL generated by all accessing applications. 通过数据库进行应用程序集成需要完全控制所有访问应用程序所生成的SQL。

The answer to your main question is no. 您主要问题的答案是否定的。 The point of database first development is to regenerate your model after each database modification - especially if each database modification is breaking change (another reason why integration through database is not a good choice for you). 数据库首次开发的重点是在每次数据库修改后重新生成模型-尤其是如果每次数据库修改都在更改变更时(通过数据库集成对您来说不是一个好选择的另一个原因)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM