Advantages of moving to Linq? Sample Project

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
Is it worth moving over to Linq completely?

This is about the best demo I could find. However for a simple datagridview with Insert/Update and Deletes, it seems like an awfully large amount of code and work to get it done.

http://www.codeproject.com/Articles/26657/Simple-LINQ-to-SQL-in-C
This should cover it. http://www.linqpad.net/WhyLINQBeatsSQL.aspx
Remember the decision is never about this vs. that. It's quite natural (and advised) to mix Linq and SQL; similarly to mix Functional Programming and OOP; no sense in complicating your life if the alternative is easier.
 

Solarion

Honorary Master
Joined
Nov 14, 2012
Messages
21,886
[)roi(];18126073 said:
This should cover it. http://www.linqpad.net/WhyLINQBeatsSQL.aspx
Remember the decision is never about this vs. that. It's quite natural (and advised) to mix Linq and SQL; similarly to mix Functional Programming and OOP; no sense in complicating your life if the alternative is easier.

Thanks roi. Having a read.

Edit: I just seem to be gravitating towards Linq. Not sure why. Maybe I just need a change.
 
Last edited:

freddster

Expert Member
Joined
Dec 13, 2013
Messages
2,470
He he he. How long would it take to write something like that from scratch? Have worked with a datagrid , can be a mission.
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
Thanks roi. Having a read.

Edit: I just seem to be gravitating towards Linq. Not sure why. Maybe I just need a change.
Just be aware that the the only issue with Linq to SQL (and not Linq in general); is that Microsoft still hasn't (AFAIK) provided a clear future for Linq to SQL; whilst it's been popular with developers, internally it seems to be a little unloved, quite probably because of the way it started.

Linq to SQL, unlike Microsoft's other data products was originally developed by the compiler team, and shortly after it's release, they passed the buck for it's future to the data team; who by all reports were already committed to a different solution called "Entity Frameworks". For a period it almost seemed like the Microsoft Data Team was actively pushing to deprecate it; well they said as much in a few posts... however there was quite a bit of push back from the developer community, and that decision was, at least officially rescinded (internally is anyone's guess).

Yet by comparison with the alternatives; Linq to SQL still remains the runt of the litter; unloved and by in large unchanged.

The following is a comment from a developer that was on the Data Team (in 2009) wrt Linq to SQL:
We said we would improve the core of it and add customer requests where it makes sense but that Entity Framework would be the primary focus. If you heard otherwise it certainly wasn’t from this team. https://damieng.com/blog/2009/06/01/linq-to-sql-changes-in-net-40
All of the communication is old; so I guess we can assume nothing's changed. You can use it, but don't expect anything more than bug fixes.
 

Solarion

Honorary Master
Joined
Nov 14, 2012
Messages
21,886
I have really just perfected working with three-tier/layer and have a solution now that I am really happy with; that I can use for any future solutions with minimum effort (born out of laziness). Maybe I am just complicating my life at this point.

Thanks for the resources and information roi. I will go over them and at least give it the time and effort to become more familiar with the pros and cons.
 

animal531

Expert Member
Joined
Nov 12, 2013
Messages
2,729
I wouldn't use Linq to SQL for anything except the most simple of projects, and even then you need to be aware of its performance issues.
If you want to go Microsoft then rather do EF, that's a lot better.

For either in general you need to do a lot of CRUD or use a generator...lots of schlep involved.


If you can use something else then MicroORM's like Dapper are great. There you can just use generics for pretty much everything, and its performance is way better.
 
Top