I'm evaluating Subsonic and ran into something in SQL Profiler.
The issue I'm seeing is when doing a linq query to select a single item by pk, the Profiler shows it not as a parameterized query, and under BatchStarting and BatchCompleted.
I did what I think is an identical query using Linq2Sql and got the expected RPC:Completed parameterized query in Sql Profiler.
I found a references on this but never found a resolution From a post on Rob's blog about Preview 2 (Comment from Todd Nov 15, 2008) http://blog.wekeroad.com/blog/subsonic-3-0-preview-2/
SubSonic Code:
TestDB db = new TestDB("TestDB");
int id = 1;
Location loc = db.Locations.Where(l => l.LocationId == id).Single();
Assert.IsNotNull(loc);
Yields:
SELECT [t0].[Address1], [t0].[Address2], [t0].[City], [t0].[CreatedBy], [t0].[CreatedOn], [t0].[LocationId], [t0].[LocationName], [t0].[NaicsId], [t0].[OwnerId], [t0].[StateId], [t0].[UpdatedBy], [t0].[UpdatedOn], [t0].[Version], [t0].[ZipCode]
FROM [Demo].[Locations] AS t0
WHERE ([t0].[LocationId] = 1)
Linq to Sql:
using (DataClasses1DataContext ctx = new DataClasses1DataContext())
{
int id = 1;
Location loc = ctx.Locations.Where(l => l.LocationId == id).Single();
Assert.IsNotNull(loc);
}
Yields:
exec sp_executesql N'SELECT [t0].[LocationId], [t0].[LocationName], [t0].[Address1], [t0].[Address2], [t0].[City], [t0].[StateId], [t0].[ZipCode], [t0].[NaicsId], [t0].[OwnerId], [t0].[CreatedBy], [t0].[CreatedOn], [t0].[UpdatedBy], [t0].[UpdatedOn], [t0].[Version]
FROM [Demo].[Locations] AS [t0]
WHERE [t0].[LocationId] = @p0',N'@p0 int',@p0=1
What am I missing?