处理 WCF 服务应用程序上的数据库更改
Dealing with database changes on WCF Service application
我正在从事一个将客户端-服务器应用程序迁移到 .NET 的项目。现在我将项目分为 3 层:
* DataLayer (Entity framework) DLL
* ServiceLayer (WCF Service) DLL
* ClientLayer (WPF EXE, using MVVM pattern)
App需要连接多个数据库(结构相似)。数据库经常更改以反映新的业务需求)。
现在我的问题是:
1) Is this scenario suitable for Entity Framework (because of dealing
with database changes)?
2) In this case, if i need to add a new field to say customer table, i should add the field to the database, and then update the schema on DataLayer, right? I also need to update the contracts on service layer to reflect proxy clases... and also need to modify client to change the view to obtain and send the new field to the database. So i need to re-compile all three modules for a single
field added to one table?
3) Is there a best alternative on .NET for dealing with this problems, in a way that if i need to add a new field to one table i only need to re-compile client side code?
谢谢!
到目前为止,最简单的解决方案是让您的 EF 层与您的所有数据库模式一起工作,而无需使用视图重新编译。
在目标数据库中的视图上构建 EF 层。当您对数据库进行更改时,请确保视图已更新,以便它们的行为与以前一样。这应该意味着您的 EF 层将适用于具有这些视图的任何数据库。
我正在从事一个将客户端-服务器应用程序迁移到 .NET 的项目。现在我将项目分为 3 层:
* DataLayer (Entity framework) DLL
* ServiceLayer (WCF Service) DLL
* ClientLayer (WPF EXE, using MVVM pattern)
App需要连接多个数据库(结构相似)。数据库经常更改以反映新的业务需求)。
现在我的问题是:
1) Is this scenario suitable for Entity Framework (because of dealing with database changes)?
2) In this case, if i need to add a new field to say customer table, i should add the field to the database, and then update the schema on DataLayer, right? I also need to update the contracts on service layer to reflect proxy clases... and also need to modify client to change the view to obtain and send the new field to the database. So i need to re-compile all three modules for a single field added to one table?
3) Is there a best alternative on .NET for dealing with this problems, in a way that if i need to add a new field to one table i only need to re-compile client side code?
谢谢!
到目前为止,最简单的解决方案是让您的 EF 层与您的所有数据库模式一起工作,而无需使用视图重新编译。
在目标数据库中的视图上构建 EF 层。当您对数据库进行更改时,请确保视图已更新,以便它们的行为与以前一样。这应该意味着您的 EF 层将适用于具有这些视图的任何数据库。