以前framework 里边,可以通过如下方式获取到 DBContext
var 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已经被移除了, 这里要如何实现?
猛跑小猪
12345678_0001
素胚勾勒不出你