Dab tsi yog concurrency hauv Entity Framework?
Dab tsi yog concurrency hauv Entity Framework?

Video: Dab tsi yog concurrency hauv Entity Framework?

Video: Dab tsi yog concurrency hauv Entity Framework?
Video: Yog ntuj tsis pab ntshe kuv tuag lawm 8/6/2018 2024, Kaum ib hlis
Anonim

Concurrency Kev tswj hwm hauv Lub Koom Haum Ua Haujlwm Core. Concurrency kev tsis sib haum xeeb tshwm sim thaum ib tus neeg siv tau txais ib qho qhov chaw cov ntaub ntawv txhawm rau hloov kho nws, thiab tom qab ntawd lwm tus neeg siv hloov kho tib yam qhov chaw cov ntaub ntawv ua ntej thawj tus neeg siv cov kev hloov pauv tau sau rau hauv cov ntaub ntawv.

Ib yam li ntawd, Entity Framework ua haujlwm li cas?

Lub Koom Haum Ua Haujlwm txhawb kev cia siab sib npaug los ntawm lub neej ntawd. EF saves ib qhov chaw cov ntaub ntawv mus rau lub database, xav tias tib cov ntaub ntawv tsis tau hloov txij li thaum lub qhov chaw tau loaded. Yog tias nws pom tias cov ntaub ntawv hloov pauv, ces qhov kev zam yog muab pov tseg thiab koj yuav tsum daws qhov teeb meem ua ntej sim khaws nws dua.

Tsis tas li, dab tsi yog tus neeg siv khoom yeej thiab lub khw yeej hom hauv Entity Framework concurrency? Hauv khw yeej / database yeej cov ntaub ntawv los ntawm lub server yog loaded rau hauv koj qhov chaw khoom. Cov neeg siv khoom yeej yog opposite rau khaws cia yeej , data los ntawm qhov chaw cov khoom raug khaws cia rau hauv database. Peb yuav tsum siv txoj kev "Refresh" ntawm cov koom haum moj khaum cov ntsiab lus thiab peb yuav tsum tau siv "RefreshMode" enum rau tib yam.

Xav txog qhov no, koj txhais li cas los ntawm concurrency?

Concurrency yog lub peev xwm ntawm lub database tso cai rau ntau tus neeg siv los cuam tshuam ntau yam kev lag luam. Qhov no yog ib qho ntawm cov khoom tseem ceeb uas cais cov ntaub ntawv los ntawm lwm cov ntaub ntawv khaws cia zoo li cov ntawv nthuav qhia. Muaj peev xwm muab tau sib npaug yog tshwj xeeb rau databases.

Web API tswj kev sib koom ua ke li cas?

Yuav ua li cas tuav concurrency hauv ASP. NET Core Web API . Tsim ib qhov project khoob thiab hloov tshiab Startup chav kawm ntxiv cov kev pabcuam thiab nruab nrab rau MVC. Ntxiv ib tus maub los nrog GET thiab PUT los ua qauv qhia sib npaug . Xa daim ntawv thov GET thiab saib ETag header (siv Postman).

Pom zoo: