DAL层
public class BaseDal<T> where T : class , new()
private DbContext db = EFDbcontextFactory.GetcurrentDbcontext();
创建类
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using Dulei.Model;
namespace Dulei.DAL
{
public class EFDbcontextFactory
{
public static DbContext GetcurrentDbcontext()
{
//可以直接对Model模型进行切换。只要更改DataModelContainer()
return new DataModelContainer();
}
}
}