AutomaticMigrationsEnabled yog dab tsi?
AutomaticMigrationsEnabled yog dab tsi?

Video: AutomaticMigrationsEnabled yog dab tsi?

Video: AutomaticMigrationsEnabled yog dab tsi?
Video: 002 - Temple Coding - Entity Framework 2024, Plaub Hlis Ntuj
Anonim

Re: AutomaticMigrationsEnabled thov pab

Qhov ntawd txhais tau hais tias txhua zaus koj xav synchronize koj cov ntaub ntawv nrog cov kev hloov pauv uas koj tau ua rau koj tus qauv, koj yuav tsum siv Add-Migration hais kom ua rau scaffold kev tsiv teb tsaws, tom qab ntawd hloov kho-database los thawb cov kev hloov pauv rau hauv cov ntaub ntawv.

Yog li ntawd, kuv yuav ua li cas qhib kev tsiv teb tsaws tsis siv neeg?

Qhib lub Pob Tus Thawj Tswj Console los ntawm Cov Cuab Yeej → Cov Tsev Qiv Ntawv Pob Tus Thawj Tswj → Pob Tus Thawj Tswj Console thiab tom qab ntawd khiav lub pab - kev tsiv teb tsaws chaw -EnableAutomaticMigration: $ qhov tseeb hais kom ua (kom paub tseeb tias qhov project default yog qhov project uas koj cov ntsiab lus hauv chav kawm yog).

Ib yam li ntawd, kev tsiv teb tsaws chaw ua li cas? Pab - Kev tsiv teb tsaws chaw : Enables lub kev tsiv teb tsaws chaw hauv koj qhov project los ntawm kev tsim chav kawm Configuration. Ntxiv- Kev tsiv teb tsaws chaw : Tsim ib qho tshiab kev tsiv teb tsaws chaw chav kawm raws li teev npe nrog Up() thiab Down() txoj kev.

Hauv qhov no, auto migration yog dab tsi?

Tsis Siv Neeg Migrations tso cai rau koj siv Code First Kev tsiv teb tsaws chaw tsis muaj cov ntaub ntawv code hauv koj qhov project rau txhua qhov kev hloov pauv koj ua. Tsis yog txhua qhov kev hloov pauv tuaj yeem siv tau - piv txwv li kem renames yuav tsum tau siv cov code-based kev tsiv teb tsaws chaw.

Kuv yuav tsim kev tsiv teb tsaws chaw hauv Entity Framework li cas?

Ntxiv ib Kev tsiv teb tsaws chaw Yog li, ua ntej, koj yuav tsum tau tsim a kev tsiv teb tsaws chaw . Qhib pob Tus Thawj Tswj Console los ntawm cov ntawv qhia zaub mov Cov cuab yeej -> NuGet Pob Tus Thawj Tswj -> Pob Tus Thawj Tswj Console hauv Visual Studio thiab ua raws li cov lus txib hauv qab no ntxiv ib qho. kev tsiv teb tsaws chaw . Yog tias koj siv dotnet Command Line Interface, ua raws li cov lus txib hauv qab no.

Pom zoo: