What are the pros/cons of both? Also, I've heard various rumors concerning if Microsoft will continue to support LINQ to SQL, any further info on this would be appreciated.
问题:
回答1:
L2S will continue to be supported from what I understand, from what I recall from the last PDC, all focus is being put on L2E for .NET 4.0.
From my experimenting with the current state of L2E, its 'less than adequate'. Especially in the speed area. I did some simple performance testing, and my L2S queries were sometimes 2-4x faster than L2E, and that is even with precompiling the L2E views.
回答2:
LINQ to SQL is for apps which will only use SQL, ever.
Entity Framework is for apps which need to provide a pluggable backend (Oracle, MySQL, SQL, XML, etc) datasource.
My philosophy on rumors is to use what makes sense for the project at hand that you consider stable and worry about "support" when you get official statements from MS (or any other company) positively or negatively to that effect. As of right now both are supported.
回答3:
This post points to some info. in particular 3 main differences:
The ability to query relational stores other than Microsoft SQL Server
A full textual query language not limited to LINQ's language support
Advanced mapping facilities, such as mapping a single class to multiple tables
回答4:
Can you use NHibernate instead? It's very mature and has huge support from the community.