由两个不同的项目使用相同的数据库 [英] Using the same database by two different projects

查看:168
本文介绍了由两个不同的项目使用相同的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的新作品中,他们有两个ASP.net项目.两个项目都使用相同的MS SQL数据库.每个项目都有一个不同的开发团队和最终用户.每个项目都有自己的表,并且有一个公共表,两个项目都可以读取/写入数据,有时它们使用此公共表相互发送信息.即,一个系统插入记录,另一个系统更新该记录中的标记(表示是的,我可以看到它"),并更新一些字段,然后第一个系统捕获数据...等等.

In my new work, they have two ASP.net projects. Both projects are using the same MS SQL Database. Each project has a different developing team and end users. And each project has its own tables, and there are a common tables which both projects reads/writes data, and sometimes they use this common tables to send information to each other. i.e one system insert record, the other system update a flag in this record which means 'Yeah I can see it', and update some fields, then the first system catch the data ... etc.

我的第一个问题:这是一个好的设计,缺点是什么?

My first question: Is this a good design, what are the disadvantages ?

另一方面,我认为将数据库分为两个数据库,每个项目一个数据库,并通过Web服务在它们之间进行通信.

In the other hand my opinion to split the database into two databases, one for each project, and make communications between them be through web services.

我的第二个问题:哪种方法是最佳实践,为什么?

My second question: which approach is the best practice, and why ?

推荐答案

我认为让两个不同的项目共享一个公共数据库没有任何问题.我建议不要将数据库分为两个单独的数据库,而建议仅使用一个数据库,并创建第三个单独的WCF项目.这个WCF项目只有一个目的,即充当数据库层,因此所有数据库查询都将写入该服务中,而asp.net项目将使用它.

I do not think there is any problem of having two different projects sharing a common database. Instead of splitting database into two separate databases , I would suggest have single database only and create a third separate WCF project. This WCF project will have only one purpose that is act as database layer , so all the database queries will be written in that service and asp.net projects will consume it.

这种方法的优点是所有查询都将被集中化并且不会有任何重复的查询.将来,如果系统中引入了任何新的模块(例如桌面应用程序或移动应用程序),则无需放置大型模块数据库查询方面的努力.相同的查询可以在所有地方使用,因此维护会更简单.

Advantage of this approach is that all the queries will be centralized and there will not be any duplication of queries.Also in future if any new Module comes in the system like desktop application or Mobile application then there is no need to put large efforts in database queries. Same queries can be used in all places, so maintenance will be simpler.

这篇关于由两个不同的项目使用相同的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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