/// <summary> /// Create a new instance of type T. /// </summary> /// <returns></returns> public virtual T CreateInstance() { T entity = Activator.CreateInstance <T> (); GetTable.InsertOnSubmit(entity); return(entity); }
public void Add(T entity) { if (!Exists(entity)) { GetTable.InsertOnSubmit(entity); } else { Update(entity); } SaveAll(); }
}//End Repository Constructor public OperationResult AddItem(T entity) { OperationResult opResult = OperationResult.GetInstance(); try { GetTable.InsertOnSubmit(entity); this._dataContextFactory.SaveAll(); opResult.ObjectId = PrimaryKeyName; } catch (Exception ex) { opResult.IsFailed = true; opResult.ErrorMessage = ex.Message + ex.StackTrace; } return(opResult); }
/// <summary> /// Add the entity to DB /// </summary> /// <param name="entity">DB entity</param> /// <returns>bool</returns> public bool Add(GenericEntityType entity) { if (entity == null) { _Logger.Error(typeof(GenericEntityType).Name + " is null to ADD!"); return(false); } try { GetTable.InsertOnSubmit(entity); if (_Flag) { _DataContext.SubmitChanges(); } return(true); } catch (Exception e) { _Logger.Error(typeof(GenericEntityType).Name + " could not be ADDED -- " + e); return(false); } }
public void Create(T entity) { GetTable.InsertOnSubmit(entity); }
/// <summary> /// Inserts the specified obj. /// </summary> /// <param name="obj">The obj.</param> public void Insert(T obj) { GetTable.InsertOnSubmit(obj); }
public void MarkForAdd(T entity) { GetTable.InsertOnSubmit(entity); }