Wednesday, 15 June 2011

c# - 'System.Reactive.Concurrency.Scheduler.NewThread' is obsolete -



c# - 'System.Reactive.Concurrency.Scheduler.NewThread' is obsolete -

i trying retrieve info database using entity-framework 5.0 code fast , reactive extensions (rx). writing next code that.

var obs = datacontext.getdatacontext().breakdowncauses.orderby(x => x.cause).toobservable(scheduler.newthread); obs.subscribeondispatcher().subscribe(x => itemcollection.add(slow(x))); breakdowncause slow(breakdowncause cs) { system.threading.thread.sleep(500); homecoming cs; }

but show me warning :

'system.reactive.concurrency.scheduler.newthread' obsolete: 'this property no longer supported due refactoring of api surface , elimination of platform-specific dependencies. please add together reference system.reactive.platformservices assembly target platform , utilize newthreadscheduler.default obtain instance of scheduler type. see http://go.microsoft.com/fwlink/?linkid=260866 more information.'

and @ runtime exception :

the calling thread cannot access object because different thread owns it.

please suggests me how can utilize reactive extensions (rx) in ef5.0 code fast in wpf application or batter way phone call database asynchronously.

you need phone call observeondispatcher instead of subscribeondispatcher. see here.

c# .net wpf entity-framework system.reactive

No comments:

Post a Comment