以前framework 里邊,可以通過如下方式獲取到 DBContextvar entities = CallContext.GetData(name) as Entities;if (entities == null){ entities = new MyEntities(); CallContext.SetData(name, entities);}return entities;PS: Entities : DBContext在net core 2.1 里邊,CallContext已經(jīng)被移除了, 這里要如何實現(xiàn)?
net core 中獲取DBContext的問題
慕尼黑5688855
2018-07-12 09:09:29