第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何為多個上下文啟用EF遷移到單獨(dú)的數(shù)據(jù)庫?

如何為多個上下文啟用EF遷移到單獨(dú)的數(shù)據(jù)庫?

開心每一天1111 2019-11-22 14:01:37
如何在同一項(xiàng)目中為多個數(shù)據(jù)庫上下文啟用Entity Framework 5(5.0.0版)遷移,其中每個上下文對應(yīng)于其自己的數(shù)據(jù)庫?當(dāng)我Enable-Migrations在PM控制臺(Visual Studio 2012)中運(yùn)行時,由于存在多個上下文而出現(xiàn)錯誤:PM> Enable-MigrationsMore than one context type was found in the assembly 'DatabaseService'.To enable migrations for DatabaseService.Models.Product1DbContext, use Enable-Migrations -ContextTypeName DatabaseService.Models.Product1DbContext.To enable migrations for DatabaseService.Models.Product2DbContext, use Enable-Migrations -ContextTypeName DatabaseService.Models.Product2DbContext.如果我運(yùn)行,則Enable-Migrations -ContextTypeName DatabaseService.Models.Product1DbContext不允許運(yùn)行,Enable-Migrations -ContextTypeName DatabaseService.Models.Product2DbContext因?yàn)檫w移已存在:Migrations have already been enabled in project 'DatabaseService'. To overwrite the existing migrations configuration, use the -Force parameter.
查看完整描述

3 回答

?
qq_遁去的一_1

TA貢獻(xiàn)1725條經(jīng)驗(yàn) 獲得超8個贊

由于Configuration.cs文件已經(jīng)存在,因此對Enable-Migrations的第二次調(diào)用失敗。如果重命名該類和文件,則應(yīng)該能夠運(yùn)行該第二次Enable-Migrations,這將創(chuàng)建另一個Configuration.cs。


然后,您將需要指定在更新數(shù)據(jù)庫時要使用的配置。


Update-Database -ConfigurationTypeName MyRenamedConfiguration


查看完整回答
反對 回復(fù) 2019-11-22
  • 3 回答
  • 0 關(guān)注
  • 636 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號