public bool Update(T obj) { var query = _dapperQueryBuilder.UpdateQuery(obj); var result = this._mysqlConnection.Execute(query); _logger.Information("{source} {template} {dbquery} {dbqueryresult}", "repository", typeof(T).Name, query, result); return(result == 1); }
public void UpdateQueryShouldReturnInsertIntoStatement() { // Given var guid = "2d62fa93-1be2-4e71-a8df-531b2fc278c3"; var now = DateTime.Now; var entity = new SampleEntity() { ID = 1, Guid = guid, sampleInt = 2, sampleStr = "str", sampleBool = true, sampleDateTime = now }; var dapperQueryBuilder = new DapperQueryBuilder <SampleEntity>(); // When var query = dapperQueryBuilder.UpdateQuery(entity); // Then Assert.AreEqual($"update samples set sampleint=2, samplestr='str', samplebool=True, sampledatetime='{DateTime.Now}', isactive=False, isdeleted=False, updatedat='{now}' where id=1 || guid='{guid}'", query); }