If you are using LINQ (or want to try it) and want to try out your query expressions dynamically you'll want to check out LINQPad.
Free (as in beer) and very useful!
random ramblings about mostly tech stuff...
If you are using LINQ (or want to try it) and want to try out your query expressions dynamically you'll want to check out LINQPad.
Free (as in beer) and very useful!
I'm playing around with LINQ for the moment. Actually I tried Entity Framework first, but could not get that to behave as I wanted (that is Table Per Class), so I let that rest for a while until they fix TPC support in a subsequent version and tried "plain" LINQ instead.
I can't say I'm really there yet, but one thing that bit me was that I out of old habit (or whatever) used code similar to the following:
using (DataClassesDataContext db = new DataClassesDataContext();
{
return (from user in db.Users
where user.Name == name
select user).SingleOrDefault();
}
..and I thought that all was well. However, when testing a little bit more I got ObjectDisposedException:s when returning
return (from user in db.Users select user).AsEnumerable();
return (from user in db.Users select user).ToList();
Turns out that even though DataContext implements IDisposable, you should not use a DataContext in a using statement or directly call .Dispose() or you'll end up with lots of brokenness.
(In addition I got all kinds of attaching and detaching issues, but I think I've sorted them now. Did I already tell you that this is my first attempt of using LINQ non-trivially?)