Home > Net >  Multithreading and EF?
Multithreading and EF?

Time:09-29

In dealing with the two different things. A, B, their data will be separate into A table, table B, but the handle is made of EF method among,

Such as: _shareService. The Save ()

Open two threads ThreadA/ThreadB

Thread ThreadA=new Thread (AProcess)

Thread ThreadB=new Thread (BProcess)

Methods: AProcess things A

Methods: BProcess things B

Then invoke _shareService. The Save () method, and Save the data,

Thread A/thread B is synchronous,


An error has occurred: at first not to have the same property names to the same change EntityMemberChanging tracker calls or EntityComplexMemberChanging before calling the EntityMemberChanged or EntityComplexMemberChanged, reports the correct change information, please refer to the Entity Framework document,

To ask is how to return a responsibility? Thank you very much!!

CodePudding user response:

A, B should be executed asynchronously

Type A, B, need their own to create A database context: dbContextA, dbContextB, call their respective savechange, rather than the common one

CodePudding user response:

The
  • Related