可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am looking to develop a website for a news channel.
So, Obviously its gonna receive a lot of hits daily and will be updated a lot on daily basis..
I have experience in ASP.Net and SQL Server..
These are the technologies i am considering to work with. Please help me choose the right method considering the amount of load it will take..
Technology??
1) ASP.Net Webforms
2) ASP.Net MVC 1.0
And data access??
1) Linq to SQL (Impressive but rumours say Microsoft is abandoning it)
2) Linq to Entities (Performance issues)
3) Datreader/Dataset
4) SubSonic (No idea)
5) NHibernate (No idea)
Please explain your point while leaving your comment..
Thanks
Chitresh
回答1:
My tools of choice right now are ASP.Net MVC 1.0 and NHibernate.
Here's my reasoning:
ASP.Net MVC
I prefer MVC over WebForms for the following reasons.
- ASP.Net MVC clearly separates my controller logic from my views
- In ASP.Net MVC I don't have to work through the page life cycle that we have in WebForms
- I find it easier to write AJAX applications in ASP.Net MVC using a good Javascript library like jquery. ASP.Net MVC also makes it super easy to return results as JSON without much work
- It is more straightforward to write tests for an ASP.Net MVC application. As a consultant I have to multi-task between several projects at once and having good tests makes it easier to move from one project to the next.
NHibernate
While there is a decent learning curve with NHibernate it makes persisting your entities much easier. I like that with NHibernate I can:
- Automatically Lazy load my collections
- Cascade deletes and updates from a root object down to it's child object
- A robust set of query objects including Linq, Criteria API and HQL (even direct SQL if you really want to)
- Several caching options
If you're going to use NHibernate I would definitely use FluentNhibernate. It makes the mappings much easier.
回答2:
If I were you I would use LINQ to SQL without fear of Microsoft "abandoning" it. First, Microsoft isn't abandoning LINQ to SQL they're creating another path for it for the purposes of allowing other vendors (Oracle, DB2, etc) to LINQ into it so-to-speak. I have read several posts by key members of the LINQ team and they will continue making modifications to LINQ to SQL and the migration path from that to their newer tool will be easy. Second, LINQ to SQL is soooo easy to use with the data context. If you know SQL then learning LINQ isn't too difficult.
As far as which technology to use, 1) ASP.Net Webforms or 2) MVC: my answer is that they're not mutually exclusive. Webforms can be built on top of the MVC model or not. It's up to you whether or not you use MVC. If you want your website to be completed quick and dirty, I would probably skip MVC. If you want your website to be easily extensible in the future and/or allow graphic designers to make changes to the design without messing up code then I would implement MVC.
回答3:
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).
回答4:
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.
回答5:
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.
回答6:
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.
回答7:
Since you are already familiar with ASP.NET and SQL, why not look into ASP.NET MVC and SubSonic. I think the new .NET MVC promotes cleaner and more organized code and the SubSonic ORM seems to get you up and running very fast for getting your data base involved with your code. Here's a link to find out more about SubSonic http://subsonicproject.com/docs/The_5_Minute_Demo. There's my thoughts! :)
BTW, I personally use ASP.NET MVC and NHibernate.
回答8:
I'm just developing something and was at the same crossroads you are now.
If you're a seasoned developer I suggest you go with Asp.net MVC. Overall I've had a great experience with it.
Considering your DAL it's a bit more tricky.
We did choose to go with LINQ to Entities (since L2SQL is abandoned), but we ended up using custom T4 templates that generate code out of EDMX file. It works great and we have all the possible customisation we need. But if I had to choose now, I'd probably rather go with either Subsonic 3 (because of the LINQ to DB support and T4 generator) or Fluent nHibernate. I know Subsonic isn't probably going to deliver exactly what I would need, but I'd be able to customize the templates. nHibernate on the other side doesn't support LINQ to DB which was something of my preference.
Edit
If you ask me: LINQ to Entities is basically LINQ to SQL with additional mapping to custom types. Ok. There are alyo some minor differences but in general that's what it is. And it seems natiral that MS is abandoning it.
回答9:
If you want a simple clean design thats fun to implement and extend in the future ill go with asp.mvc and entity framework. I would start out with the movie database video tutorial off of the asp.net mvc website.