Only getting changed data

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Only getting changed data

Post by Zero-G. » Thu 16 Jul 2009 07:37

Hey

Is there a way, how to "only" get changed data from the server?
As an example:

Let's say, I have an central server where all my customers names are stored. - By loading my program, all these customers are loaded into a Grid. - When a a second user on an other PC also loads my program and changes some customers data, then the first one, does not have the correct data anymore, so I want to make a Timer, that the program itself always looks for any kind of changed data and automaticly send to the user.

Hope you understand and can help me, how to realise this with LinQ to SQL

THX

PS: If this will help: I use one column as a timestamp and a trigger, so in the Class the timestamp field is declared as IsVersion.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 16 Jul 2009 11:54

Try to use the DataContext.Refresh(RefreshMode.KeepChanges, ) method.

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Post by Zero-G. » Sun 30 Aug 2009 09:43

Hey

Today I tried your sample with the following code statement:

Code: Select all

LinQProvider.Refresh(Data.Linq.RefreshMode.KeepChanges, LinQProvider.Lieferantens)
There I get an "NotSupportedException" Error with the following StackTrace

bei Devart.Data.Linq.Provider.DataProvider.f()
bei Devart.Data.Linq.DataContext.get_CommandTimeout()
bei Devart.Data.Linq.Mapping.b.Accessor`3.a(T A_0)
bei System.Data.Linq.Mapping.MetaAccessor`2.GetBoxedValue(Object instance)
bei Devart.Data.Linq.MultiKeyManager`2.CreateKeyFromInstance(T obj)
bei Devart.Data.Linq.KeyManager`2.a(Object A_0)
bei Devart.Data.Linq.DataContext.Refresh(RefreshMode mode, Object entity)
bei VOPT.LinqProvider.GetLieferanten(Boolean Enforce)
bei VOPT.ISAuftrag..ctor(Kundenstamm KundenDaten, Auftragstyp Typ)
bei VOPT.usrKundenstamm.cmdBrille_Click(Object sender, CommandEventArgs e)
bei Janus.Windows.Ribbon.CommandBase.OnClick(CommandEventArgs e)
bei Janus.Windows.Ribbon.CommandBase.InvokeOnClick()
bei Janus.Windows.Ribbon.ButtonCommand.InvokeOnClick()
bei Janus.Windows.Ribbon.JNSD.OnMouseUp(MouseEventArgs e)
bei Janus.Windows.Ribbon.JNSAO.OnMouseUp(MouseEventArgs e)
bei Janus.Windows.Ribbon.JNSCE.OnMouseUp(MouseEventArgs e)
bei Janus.Windows.Ribbon.JNSCM.a(MouseEventArgs )
bei Janus.Windows.Ribbon.Ribbon.OnMouseUp(MouseEventArgs e)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei Janus.Windows.Ribbon.Ribbon.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(Form mainForm)
bei VOPT.VisualOPTNet.Initialize()
bei VOPT.Start.Main()
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()

Any Tips?

THX

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 01 Sep 2009 12:07

It is necessary to pass IQueriable instead of the DataContext class in .
For example: DataContext.DEPTS or from d in DataContext.DEPTS select d.

Post Reply