471,330 Members | 1,212 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Static CompiledQuery bug

I used the following static compiled query to retrieve Product object from
our database:

private static readonly Func<MyDBDataContext, int, IQueryable<Job>>
StaticCompiledQuery = CompiledQuery.Compile((MyDBDataContext dbContext,
int productID) =>

from p in dbContext.Products

where p.ProductID == productID

select p);

StaticCompiledQuery(dbContext, productID).SingleOrDefault()

If an object is retrieved using static compiled query it can be updated only
once when it first time loaded into the DataContext. After that any changes
to the objects retrieved using the same compiled query are ignored, namely
you can change any field of the retrieved object in the memory but the
changes are not saved in the database after SubmitChanges(). This makes
static compiled queries totally unpractical!

Any help will be much appreciated!

Jul 24 '08 #1
0 842

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Scott J. McCaughrin | last post: by
15 posts views Thread by Samee Zahur | last post: by
3 posts views Thread by Mauzi | last post: by
3 posts views Thread by Jay | last post: by
3 posts views Thread by Kirk Marple | last post: by
14 posts views Thread by Jess | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.