June 23, 2010 09:55 by
bryan
dd6e2e10-0835-4d36-bcd5-160dffc909e6|0|.0
June 22, 2010 11:25 by
bryan
You may or may not have come across the ability within LINQ to SQL to have mapping to and from your own objects.
Microsoft has a mapping builder called sqlmetal, which is a code generation tool to generate the mapping automatically.
Here is a sample command line to generate the mapping file.
1
|
sqlmetal /server:. /database:mydb /map:mydbMappings.xml /code:code.dbml |
0e3f555b-f310-4ee5-befc-574d57196f63|0|.0
November 18, 2009 10:25 by
bryan
Having been using LINQ to SQL for some time now, I came across my very first issue "There is already an open DataReader associated with this Command which must be closed first." it's been some time since I had this issue.
The issue only appears on one database and that is being held on a SQL 2000 box.
The solution, sorry work around, is to transfer the results in to Lists using ToList() after each LINQ call.
I have found it hard to replicate in my test environment, as it only happens on a clients installation.
David Foderick posted a similar issue he had with the Entity Framework
After speaking with Eric Nelson, he pointed out that SQL 2000 has a lack of support for MARS, however there is no planning to provide support for this, however SQL Azure does not allow MARS. So perhaps this issue will get addressed some time in the future?
8fa555d7-f52d-44c9-83fd-056115b8ec1c|1|1.0
September 2, 2009 19:05 by
bryan
096de7c4-c46c-42b3-aa88-5486ebcee06b|0|.0
May 26, 2009 15:10 by
bryan
I was wondering today if anyone had produced any benchmarks on the speed and performance of LINQ, so I had a look around and found that LINQ 2 SQL is 4 times faster than the Entity Framework. Why is this? It is due the the fact that the Entity Framework is a more generic solution, where as LINQ to SQL can be more fine tuned to the underlying database structure.
Here are a few links I found that might explain things in more details
ADO.NET Entity Framework Performance Comparison
How Slow is 'Slow'?
5617c8a8-9ab5-4cc7-b381-89c6221a5b6a|0|.0
May 26, 2009 09:06 by
bryan
I have found LINQ to SQL and the Entity Framework has a few missing features, one of these is the ability to update the designer diagrams, and this is where Huagati DBML come to play.
Huagati DBML/EDMX Tools is an add-in for Visual Studio that adds functionality to the Linq2SQL/DBML diagram designer in Visual Studio 2008, and to the ADO.NET Entity Framework designer in Visual Studio 2008 SP1.
0b79adaf-6a27-4899-b136-d296f733a983|1|5.0
April 17, 2009 09:55 by
bryan
When you need to find if any records exist in a table or a selective snap shot of a table, you are prehaps like me in using the COUNT(*) SQL transaction and see if there are zero counts, but is this the most efficient method?
After a performance issue on one of my applications I found a new extension to LINQ to SQL called ANY(), from Ray Booysen on StackOverflow, here is an example of the SQL that is generated from LINQ:

The Results:
SELECT COUNT(*) AS [value] FROM [dbo].[Employees] AS [t0]
9
SELECT (CASE WHEN EXISTS(SELECT NULL AS [EMPTY] FROM [dbo].[Employees] AS [t0]) THEN 1 ELSE 0 END) AS [value]
True
As you can see LINQ wins the day again.
a5461286-ed45-4f9c-b0df-e80b13c2bbe7|1|2.0
March 17, 2009 11:56 by
bryan
What with the release of LINQ to Entities, and LINQ to SQL, which one performs better?
For comparison of performance it is worth chekcing out Eric's blog, but I still perfer LINQ to SQL.
Not that I would use the Entity Framework yet, see my article on this
b6e4e9a7-4054-44a8-9bea-71f05504b207|0|.0
March 6, 2009 11:17 by
bryan
There comes a time when you are using LINQ to SQL that you just have to find out what SQL is being generated, for what ever reason that is, here a a few ways to get the SQL you are looking for:
You can use SQL Server Profile to see the traffic going to and from the database

But if you are like me you want more control over your processes, so you can use the DataContext.Log, and output the log to a window, or in the case below the console window

One last method is to just write out an objects SQL, using the GetCommand, as seen below

07733fcc-6ea4-44fe-8624-a67692e05a3d|1|3.0
February 27, 2009 12:41 by
bryan
Just found a great LINQ tool for quering any database LINQPad, is so useful I almost fell off my chair when I found it.
If you're using LINQ then this is a must on a list of tool you need to have.
When I was using it I thought it would be nice to have Autocompletion, and it does, so long as you register the product.
ca0db9e4-c887-4cf5-bee0-996aeea75b04|1|5.0