public void Add(T entity)
 {
     DbContext.Insert(entity);
 }
Beispiel #2
0
 /// <summary>
 /// 添加一个实体
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="primaryKey"></param>
 /// <returns></returns>
 public bool Insert(T entity, Expression <Func <T, object> > primaryKey = null)
 {
     return(_context.Insert(entity, ExpressionUtils.GetProperty(primaryKey)) > 0 ? true : false);
 }