views:

177

answers:

2

Is it just me or does changes produced by refreshing the LINQ DataContext not result in Changed Events?

I have a multiuser Application which has an simple atomar locking system to prevent conflicts. So if an User changes something in the database I need to trigger Refresh on the Datacontext to reload the concerning objects.

A breakpoint in the property contained in the generated Designerfile is not called while refreshing this class. Also no events are thrown.

Am I doing something wrong or is there a workaround?

+1  A: 

The Changed Events seem to represent changes in the LTS Data Classes that you can hook.

A refresh is not a change, its just a new (set) of SELECT statements, therefore there is no Changed event thrown.

JoshJordan
well is there a posibility to propagate the changes which aren't changes?
Sven Hecht
A: 

When you run a Linq query against the data context, you automatically get the latest changes to the database.

If you need to do something like automatically refresh the user's screen when the database changes, then you need to do something else. Perhaps a trigger in conjunction with SQL Server CLR integration?

Here is a linq to some sample code for creating managed triggers:
Writing Managed Triggers using C#

Robert Harvey