public bool Update(IExttriple entity) { return(mapperHelper.Update(entity, (cmd, exttriple) => UpdateParameters(cmd, exttriple), "update Exttriple set value=@value where id=@id and datetime=@datetime" )); }
public bool Delete(IExttriple entity) { return(mapperHelper.Delete(entity, (cmd, exttriple) => DeleteParameters(cmd, exttriple), "delete from Exttriple where id=@id and datetime=@datetime" )); }
protected void DeleteParameters(IDbCommand cmd, IExttriple e) { SqlParameter id = new SqlParameter("@id", e.id); SqlParameter datetime = new SqlParameter("@datetime", e.datetime); cmd.Parameters.Add(id); cmd.Parameters.Add(datetime); }
public IExttriple Create(IExttriple entity) { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { mapperHelper.Create(entity, (cmd, exttriple) => InsertParameters(cmd, exttriple), "INSERT INTO EXttriple(id, datetime, value) values(@id, @datetime, @value); select @id=id, @datetime=datetime from Exttriple;" ); ts.Complete(); return(entity); } }
protected void InsertParameters(IDbCommand cmd, IExttriple e) { SqlParameter id = new SqlParameter("@id", e.id); SqlParameter datetime = new SqlParameter("@datetime", e.datetime); SqlParameter value = new SqlParameter("value", e.value); id.Direction = ParameterDirection.InputOutput; datetime.Direction = ParameterDirection.InputOutput; cmd.Parameters.Add(id); cmd.Parameters.Add(datetime); cmd.Parameters.Add(value); }
public bool Update(IExttriple value) { if (value == null) { return(false); } ctx.Entry((Exttriple)value).State = EntityState.Modified; IExttriple newExttriple = Find(value.id, value.datetime); newExttriple.value = value.value; return(true); }
protected void UpdateParameters(IDbCommand cmd, IExttriple e) { InsertParameters(cmd, e); }
public IExttriple Insert(IExttriple value) { return(db.Add((Exttriple)value)); }
public bool Delete(IExttriple value) { return(db.Remove((Exttriple)value).Equals(value)); }
public bool Update(IExttriple value) { return(mapper.Update(value)); }
public IExttriple Insert(IExttriple value) { return(mapper.Create(value)); }
public bool Delete(IExttriple value) { return(mapper.Delete(value)); }