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

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

如何處理 EF 數(shù)據(jù)庫優(yōu)先上下文列表并正確轉(zhuǎn)換它們?

如何處理 EF 數(shù)據(jù)庫優(yōu)先上下文列表并正確轉(zhuǎn)換它們?

C#
千萬里不及你 2021-06-23 18:02:17
我有一個實(shí)體框架的 6.0 數(shù)據(jù)庫第一個上下文的列表,名稱不同。它們都包含一個名為“bill”的表。我需要檢查每個數(shù)據(jù)庫的賬單表,并根據(jù)條件將信息添加到一個新數(shù)據(jù)庫中。例子 :Company1_EntitiesCompany2_EntitiesCompany3_Entities這 3 個數(shù)據(jù)庫包含賬單表。我需要將這些賬單有條件地存儲到:All_Bills_Entities隨著公司數(shù)量的增長,我需要讓這個動態(tài)。我在想這樣的事情:Dictionary<string, DbContext> lstDB = new Dictionary<string, DbContext>();// I'm supposed to retrieve these db names from a table, but now i'm just testinglstDB.Add("00439837", new DbContext("Company1_Entities"));lstDB.Add("00439832", new DbContext("Company2_Entities"));lstDB.Add("00439839", new DbContext("Company3_Entities"));using (All_Bills_Entities main_db = new All_Bills_Entities()){    foreach(var dataBaseInfo in lstDB)    {        DbContext currentDB = dataBaseInfo.Value;        foreach (var record in currentDB.bill.ToList()) // this does not compile, there is no bill table found here        {           if(record.merchant == dataBaseInfo.Key /* && other Conditions */)           {                main_db.bill.Add(record)           }        }    }}
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 175 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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