Web services methods contain lot of scalar queries like
decimal? result;
using (var db = new MyDataContext())
result = (from entity in db.SomeTable
where entity.Id=somevalue
select d.DecimalColum).SingleOrDefault();
To make code shorter those can also be re-written as
decimal? result = (from entity in new MyDataContext().SomeTable
where entity.Id=somevalue
select d.DecimalColum).SingleOrDefault();
In this case DataContext is not wrapped to using statement and maybe dispose
is not called.
Is it ok to use queries without using ?
Can this query simplified more ?
Andrus.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---