c# - Refresh data from stored procedure -


I have the application of a c # unit framework I'm trying to run an stored procedure with code (a problem with it) Not long) its long haul, about 30 minutes I write each transaction in the form of a log in a SQL table because the process runs. I'm trying to start the process from the app, but then shows the last 10 records of the log on the screen, maybe every 10 seconds is interrogating. This will show progress.

  Private Zero Window_Loaded_1 (Object Sender, RoutedEventArgs E) {Task.Run ((=) => _serviceProduct.RefreshAllAsync ()); _cvsLog = (collection chronology) (Search Resource ("CVSOog"); Var Dispatcher timer = New system. Windows threading. Dispatcher Timer (); Sender Timer. Tick ​​+ = new event heredollar (sender timerTicket); Sender Timer. Interval = timespan; framesconds (10); DispatcherTimer.Start (); } Private zero sender timer (Object Sender, EventEurge E) {_cvslog.Source = _serviceProduct.GetRefreshLog (); }  

I changed the code to simplify Dispatcher thread block on the timestactic process It seems that the stored procedure is OK.

There is a service called here.

  Public supervision & lt; Refreshlog & gt; GetRefreshLog () using (using db = new HiggidyPiesEntities ()) {var REC (x.LG_ID in X db.RefreshLogs descending selection x orderBy) .ake (30); Var obs = New Observationable Collection & lt; RefreshLog & gt; (REC); come back; }}  

I went under background worker work and work. But the process process blocks the thread.

I also considered starting a SQL job code and then monitoring the logs with the call to the database. Maybe there might be an option to consider the service broker?

Which road should I go with this type of problem? Thanks in advance Scott

Due to the nature of this data being only a condition for the user, It seems impossible to read. You can try these two options, which seem quite straightforward:

The first thing to try is to set a session / connection property:

  Public ObservableCollection & LT; RefreshLog & gt; GetRefreshLog () using {var db = new HiggidyPiesEntities ()) {db.context.ExecuteStoreCommand ("Set Transaction Isolation Level Unread Read;"); Var RECS = (X to DB. Refresh Lodge Order By x.LG_ID descending selection X). Take (30); Var obs = New Observationable Collection & lt; RefreshLog & gt; (REC); come back; }}  

The second thing to try is to establish transaction isolation level through EF:

  Public ObservableCollection & LT; RefreshLog & gt; GetRefreshLog () using (scope = new TransactionScope (TransactionScopeOption.Required, New TransactionOptions) {IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted}) {ObservableCollection & LT; RefreshLog & gt; O bs; (Var db = new HiggidyPiesEntities ()) using {var dd. (In the order of Db.RefreshLogs x.LG_ID descending selection x). (30); Obs = new inspectory collection & lt; Refresh Log & gt; (REC); } Scope.Complete (); come back; }}  

Both thoughts taken from different answers on this question: Frank The first suggestion based on the response to Gaiman, second on the basis of Alexander.

And to be mentioned as an option, you can check the SXF SHOT ISOLAN facility which was introduced in SQL Server 2005:

  • (Search for string "snapshot_is")

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -