Calling Andrus : LINQ-to-SQL id queries

M

Marc Gravell

Well, part fixed ;-p

Single(pred) is fixed, but Where(pred).Single() still round-trips; for
example via Northwind see below.

Marc

using (NorthwindDataContext ctx = new NorthwindDataContext())
{
ctx.Log = Console.Out;
Console.WriteLine("Find first employee...");
var emp1 = ctx.Employees.First();
int id = emp1.EmployeeID;
Console.WriteLine("Where(pred)=>Single");
for (int i = 0; i < 10; i++)
{
var emp2 = ctx.Employees.Where(x => x.EmployeeID ==
id).Single();
}
Console.WriteLine("Single(pred)");
for (int i = 0; i < 10; i++)
{
var emp3 = ctx.Employees.Single(x => x.EmployeeID
== id);
}
Console.WriteLine("Exit");
}
 
A

Andrus

Marc,
Well, part fixed ;-p

Single(pred) is fixed, but Where(pred).Single() still round-trips; for
example via Northwind see below.

Thank you.
I created code generator which creates code to implement cache using static
Dictionary<entityId,value> properties for every property.
Every entity every property contains static getter method which performs
cache lookup first.
So I do'nt rely on DLinq cache.
The only way to use DLinq cache in winforms appl would be to use application
wide global DataContext class for retrieve and cache only.
However this is probably not reasonable since it does not allow to clear
cache partially.

Btw. Where find information about winforms changes ?
I have only found that there are number of new controls added, no more.

Andrus.
 
M

Marc Gravell

Btw. Where find information about winforms changes ?
I have only found that there are number of new controls added, no more.

Really? Which ones? I honestly don't expect any ground-breaking
winform developments - much of the thrust seems to be towards WPF and
Silverlight. I really must give them a good look at some point!

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top