ASP.NET MVC 应用程序的数据库和逻辑层
我将开始一个新项目,最初规模很小,但随着时间的推移可能会变得很大。我坚信我将使用 ASP.NET MVC 和 jQuery 作为 UI。由于某些原因,我想使用 MySQL 作为数据库,但担心一些事情。
我对 Linq 完全陌生,但一旦熟悉它似乎就更容易使用。
首先,访问数据应该很容易。所以我想我应该使用 MySQL to Linq,但我在某处读到它不直接支持,但 MySQL .NET 连接器添加了对 EntityFramework 的支持。我不知道它的优点和缺点是什么。我也听说过DbLinq。如果我可以实现存储库模式,我会很高兴,因为它允许在逻辑层而不是数据访问层应用过滤器。如果我使用实体框架可以吗?
我也关心表演。有人告诉我,如果我们使用实体框架,它会获取大量数据,然后对其进行过滤。是这样吗?
所以问题基本上是 -
- MySQL 到 Linq 可能吗?如果是,我可以在哪里获得更多详细信息?
- 在 MySQL 中使用 EntityFramework 或 DbLinq 的优点和缺点?
- 使用 EntityFramework 或 DbLinq 与 MySQL 访问数据是否容易?
- 我是否能够实现存储库模式,该模式允许在逻辑层而不是数据访问层应用过滤器(当我将 EntityFramework 与 MySQL 一起使用时)
- 它是否从数据库中获取大量数据,然后对其应用过滤器?
如果在这种情况下,我这边的问题听起来太多了,如果您能让我知道您作为该领域的经验丰富的人在这种情况下会做什么(有相当大的理由),那就应该回答我的问题。
I'm going to start a new project which is going to be small initially but may grow to big over the years. I'm strongly convinced that I'm going to use ASP.NET MVC with jQuery for UI. I want to go for MySQL as database for some reasons but worried on few things.
I'm totally new to Linq but it seems that it is easier to use once you are familiar with it.
First thing is that accessing data should be easy. So I thought I should use MySQL to Linq but somewhere I read that it is not directly supported but MySQL .NET connector adds support for EntityFramework. I don't know what are the pros and cons of it. DbLinq is what I also heard. I would love if I can implement repository pattern as it allows to apply filter in logic layer rather than in data access layer. Will it be possible if I use Entity Framework?
I'm also concerned about the performance. Someone told me that if we use Entity framework it fetches lot of data and then filter it. Is that right?
So questions basically are -
- Is MySQL to Linq possible? If yes where can I get more details on it?
- Pros and cons of using EntityFramework or DbLinq with MySQL?
- Will it be easy to access data using EntityFramework or DbLinq with MySQL?
- Will I be able to implement repository pattern which allows applying filter in logic layer rather than data access layer (when I use EntityFramework with MySQL)
- Does it fetches hell lot of data from database and then apply filter on it?
If it sounds too many questions from my side in that case, if you can just let me know what you will do (with a considerable reason) in this situation as an experienced person in this area, that should answer my question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于我是 ALT.NET 的粉丝,我建议您在项目中使用 NHibernate 而不是 EntityFramework,您可以通过 google 搜索它的优势,我相信您会选择它。
As I am fan of ALT.NET I would recomend you to use NHibernate for your project instead of EntityFramework, you may google for the advantages over it, I am convinced you'll choose it.
基于您提到的几点,那么我会认真考虑最初使用 MS SQL 而不是 MySQL,并实现 LINQ-to-SQL 而不是实体框架,原因如下:
我不知道您的项目是什么,但您不想陷入稍后扩展应用程序时遇到麻烦的情况。为最终结果而不是起点编写代码,这样您以后就会避免很多麻烦。
Based on the points you've mentioned, then I would seriously consider going with MS SQL instead of MySQL initially and implementing LINQ-to-SQL instead of Entity Framework, and here's why:
I don't know what your project is, but you don't want to get into a situation where you're going to have trouble scaling the application later. Code for the end result, not for the starting point, and you'll save yourself a lot of headaches later.