- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Runtime.Remoting.Contexts;
- using System.Runtime.Remoting.Messaging;
- using System.Text;
- using Dulei.Model;
-
-
- namespace Dulei.DAL
- {
- public class EFDbcontextFactory
- {
- public static DbContext GetcurrentDbcontext()
- {
- DbContext db = (DbContext) CallContext.GetData("Dbcontext");
- if (db==null)
- {
- db = new DataModelContainer();
- CallContext.SetData("Dbcontext",db);
- }
- //也可以使用HttpContext是一样的
- return db;
- }
- }
- }
posted @
2015-11-24 15:45
玻璃鱼儿
阅读(
676)
评论()
编辑
收藏
举报