通用 LINQ查询方法

public class BaseDAL<T> where T : class
{
public CiecClientDataContext db = new CiecClientDataContext();
#region MyRegion
public Table<T> GetTable()
{
return db.GetTable<T>();
}
public Table<T> GetAll()
{
return db.GetTable<T>();
}


public void Add(T t)
{
GetTable().InsertOnSubmit(t);
}

public void Delete(T t)
{
GetTable().DeleteOnSubmit(t);
}
public void Submitchanges()
{
db.SubmitChanges();
}
#endregion

posted @ 2013-07-29 00:59  沉默的码畜  阅读(253)  评论(0编辑  收藏  举报