public void InsertList <T>(dynamic tran, List <T> list) where T : new() { if (list == null || list.Count == 0) { throw new FinanceException(FinanceResult.IMPERFECT_DATA, "the object which want to update is null or empty."); } Type info = typeof(T); DataTable dt = EntityConvertor <T> .ToDataTable(list); DBHelper.GetInstance(mContext).InsertTable(tran, dt, "_" + info.Name); }
public void Insert <T>(dynamic tran, T entity) where T : new() { if (entity == null) { throw new FinanceException(FinanceResult.IMPERFECT_DATA, "the object which want to update is null."); } Type info = typeof(T); DataTable dt = EntityConvertor <T> .ToDataTable(new List <T>() { entity }); DBHelper.GetInstance(mContext).InsertTable(tran, dt, "_" + info.Name); }