2

我正在寻找为新闻频道开发一个网站。

所以,显然它每天都会收到很多点击,并且每天都会更新很多..

我有 ASP.Net 和 SQL Server 的经验..

这些是我正在考虑使用的技术。请帮我选择正确的方法,考虑到它需要的负载量..

技术??

1) ASP.Net 网络表单

2) ASP.Net MVC 1.0

和数据访问?

1)Linq to SQL(令人印象深刻,但有传言称微软正在放弃它)

2)Linq to Entity(性能问题)

3)数据读取器/数据集

4)亚音速(不知道)

5)NHibernate(不知道)

请在留下您的评论时解释您的观点。

谢谢

奇特雷什

4

9 回答 9

4

我现在选择的工具是 ASP.Net MVC 1.0 和 NHibernate。

这是我的推理:

ASP.Net MVC

由于以下原因,我更喜欢 MVC 而不是 WebForms。

  • ASP.Net MVC 清楚地将我的控制器逻辑与我的视图分开
  • 在 ASP.Net MVC 中,我不必完成 WebForms 中的页面生命周期
  • 我发现使用像 jquery 这样好的 Javascript 库在 ASP.Net MVC 中编写 AJAX 应用程序更容易。ASP.Net MVC 还可以非常容易地以 JSON 格式返回结果,而无需太多工作
  • 为 ASP.Net MVC 应用程序编写测试更为直接。作为一名顾问,我必须同时在多个项目之间执行多项任务,并且通过良好的测试可以更轻松地从一个项目转移到下一个项目。

休眠

虽然 NHibernate 有一个不错的学习曲线,但它使您的实体更容易持久化。我喜欢 NHibernate,我可以: - 自动延迟加载我的集合 - 从根对象到子对象的级联删除和更新 - 一组强大的查询对象,包括 Linq、Criteria API 和 HQL(如果你真的想要,甚至可以直接使用 SQL to) - 几个缓存选项

如果您要使用 NHibernate,我肯定会使用FluentNhibernate。它使映射更容易。

于 2009-07-14T15:55:20.887 回答
2

如果我是你,我会使用 LINQ to SQL,而不用担心微软会“放弃”它。首先,微软并没有放弃 LINQ to SQL,他们正在为它创建另一条路径,以允许其他供应商(Oracle、DB2 等)将 LINQ 引入它。我已经阅读了 LINQ 团队主要成员的几篇文章,他们将继续对 LINQ to SQL 进行修改,并且从它到新工具的迁移路径将很容易。其次,LINQ to SQL 非常容易与数据上下文一起使用。如果您了解 SQL,那么学习 LINQ 并不太难。

至于使用哪种技术,1) ASP.Net Webforms 或 2) MVC:我的回答是它们不是相互排斥的。Web 表单可以构建在 MVC 模型之上,也可以不构建。是否使用 MVC 取决于您。如果您希望您的网站快速而肮脏地完成,我可能会跳过 MVC。如果您希望您的网站将来易于扩展和/或允许图形设计师在不弄乱代码的情况下对设计进行更改,那么我将实施 MVC。

于 2009-07-14T15:12:35.853 回答
1

The choice between WebForms and MVC really comes down to whether you like the Model-View-Controller approach. Personally, I prefer WebForms but am learning MVC (within Rails) just to broaden my experience and to gain the benefits of better testing. Either will do for your case as both are capable of scaling to large systems.

With respect to data, I would encourage you to think long and hard before selecting Linq in any form. Please see these previous discussions:

Doesn't LinqToSql Miss the Point?

Is LinqToSql Powerful Enough? Aren't fluent interfaces easy to build?

I would not recommend SubSonic as the documentation is just not there. You'll be pulling your hair out trying to figure out how it works. This is sad because, in many ways, it is a better model than Linq.

In the end, I have always chosen to go with a custom DAL wrapper around ADO.NET. First, I know what I am getting. Second, you really do have to know SQL in any event so why make life more difficult by trying to learn a second data access language? The drawbacks to Linq and SubSonic are manifest and the advantages are primarily theoretical (again, see the discussions at the links for more information).

于 2009-07-14T15:17:25.580 回答
0

我只是在开发一些东西,现在正处于同一个十字路口。如果您是经验丰富的开发人员,我建议您使用Asp.net MVC。总的来说,我对它有很好的体验。

考虑到您的 DAL,这有点棘手。

我们确实选择了使用 LINQ to Entities(因为 L2SQL 已被放弃),但我们最终使用了自定义 T4 模板,这些模板从 EDMX 文件生成代码。它工作得很好,我们拥有我们需要的所有可能的定制。但如果我现在必须选择,我可能宁愿选择Subsonic 3(因为 LINQ to DB 支持和 T4 生成器)或Fluent nHibernate。我知道 Subsonic 可能不会提供我需要的东西,但我可以自定义模板。另一方面,nHibernate 不支持 LINQ to DB,这是我的偏好。

编辑 如果你问我:LINQ to Entities 基本上是 LINQ to SQL,带有到自定义类型的附加映射。好的。还有一些细微的差异,但总的来说就是这样。MS放弃它似乎很自然。

于 2009-07-14T15:31:11.543 回答
0

Performance-wise, they are all capable of handling thousands of concurrent users.

The single biggest performance consideration on any high-traffic site is caching. WebForms/MVC have excellent options for output caching actual rendered HTML (most efficient), and API caching of your data objects.

I think your best bet will be to use the data access framework in which you're most comfortable developing - which design pattern/toolset you're most familiar with. After that: cache, cache, cache.

于 2009-07-14T14:58:05.503 回答
0

You have experience with ASP.NET and I say stay with that, but if you want to learn some new it's ASP.NET MVC good way.

Data Access depends what you need and what you prefer.

LINQ2SQL and DataReader/Dataset using direct access to DB and it's fine for simple application.

LINQ2Entities, SubSonic and NHibernate are ORM frameworks and it's good for application where you need extensibility in future.

And it's good use some repository pattern to access data.

于 2009-07-14T14:58:53.350 回答
0

Microsoft isn't "abandoning" Linq-to-SQL per se, just not adding major functionality to it (in lieu of adding functionality to EF instead).

My bias would be to use ASP.NET MVC with Fluent-NHibernate. I think using those tools gives a nice balance of flexibility and ease of use. However, if you have more experience with WebForms, then using it instead will reduce your ramp-up time. I would also tend to avoid using DataSets unless absolutely necessary if you plan to use straight ADO.NET.

于 2009-07-14T15:02:10.567 回答
0

如果您想要一个简单干净的设计,那么将来实现和扩展很有趣,那么请使用 asp.mvc 和实体框架。我将从 asp.net mvc 网站上的电影数据库视频教程开始。

于 2009-07-15T02:21:41.277 回答
0

既然您已经熟悉 ASP.NET 和 SQL,为什么不研究一下 ASP.NET MVC 和 SubSonic。我认为新的 .NET MVC 促进了更清洁和更有条理的代码,而 SubSonic ORM 似乎可以让您快速启动并运行,以便让您的数据库参与您的代码。这里有一个链接可以找到更多关于 SubSonic http://subsonicproject.com/docs/The_5_Minute_Demo的链接。有我的想法!:)

顺便说一句,我个人使用 ASP.NET MVC 和 NHibernate。

于 2009-07-14T15:11:19.850 回答