LINQ、存储过程、内联查询
我们是一个小团队,在非常紧迫的期限内开发 .NET 大型 Web 应用程序。我们使用多个数据库(每个客户端一个),因此我们的要求与大多数应用程序略有不同。数据库将仅用于此特定应用程序,因此它们是否与应用程序紧密耦合并不重要。主要的决定因素是开发速度、长期可维护性和安全性。我们正在考虑 3 个选项:
选项 1 - LINQ to SQL
我们都没有任何使用 LINQ 的经验,但我们一直在研究它,它似乎是一个不错的选择,而且学习起来也不太难。值得在紧迫的期限内冒险学习一种新方法吗?
选项 2 - 存储过程
似乎维护多个数据库设置可能是一场噩梦(或者会吗?),并且它可能会减慢在另一个环境中工作的开发速度,因为我们没有专门的数据库开发人员。基本的 CRUD 查询将由代码生成器生成,这是一个优点。
选项 3 - 内联查询
这种方法是开发速度最快的方法,但我知道现在人们普遍反对硬编码查询,我担心从长远来看我们可能会遇到可维护性问题。基本的 CRUD 查询将由代码生成器生成。
如果我们遗漏了任何因素,请告诉我。什么解决方案最适合该项目?
We are a small team working on a very tight deadline to develop a large web application in .NET. We are using multiple databases (one per client) so our requirements are slightly different than most applications. The databases will only be used for this particular application so it doesn't matter if they are tightly coupled with the application. The main deciding factors are speed of development, long-term maintainability, and security. There are 3 options we are considering:
Option 1 - LINQ to SQL
None of us have any experience with LINQ, but we have been researching it and it seems like a good option and not too difficult to learn. Worth the risk of learning a new method on a tight deadline?
Option 2 - Stored Procedures
Seems like it could be a nightmare to maintain with the multiple database setup (or would it?) and it may slow down development to work in another environment as we don't have a dedicated database developer. Basic CRUD queries would be generated by code generator which is an advantage.
Option 3 - Inline Queries
This method would be the fastest to develop but I know people are generally against hard-coded queries nowadays and I fear we may suffer in the long term with maintainability issues. Basic CRUD queries would be generated by code generator.
Please let me know if there are any factors we are missing. What solution seems the most appropriate for this project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你的截止日期很紧,就不要尝试新的东西。要求开发人员在家里和业余时间学习实体框架,并在下一个项目中尝试。同时做你最了解并且过去成功使用过的事情。
如果内联查询在 DAL 程序集中解耦,那么它们也不错。
If you have a tight deadline don't try something new. Ask the devs to study Entity Framework at home and in their spare time and try it in next project. Meanwhile do what you know best and have used in past successfully.
Inline queries are not bad if they are decoupled in a DAL assembly.
因为 @Hasan Khan 涵盖了有关 SQL 的主要答案。我将给出一个有些不同的答案。另一种选择是考虑使用 RavenDB(一种 NoSQL 数据库)。它固有地融入了租户数据库的概念。从您的要求来看,这听起来像是预期的目标。
Since @Hasan Khan covered the primary answers regarding SQL. I'm going to throw out a somewhat different answer. Another option is to consider usage of RavenDB, a NoSQL db. It has the concept of Tenant databases inherently baked into it. Which from your requirements it sounds like this is the intended goal.