public int Update(Build item) { using (var connection = GetRealTimeConnection()) { connection.Open(); return connection.Execute("UPDATE [dbo].[Builds] SET RepositoryId = @RepositoryId, BuildDate = @BuildDate, DurationMilliseconds = @DurationMilliseconds, DuplicatesFound = @DuplicatesFound, MaintainabilityIndex = @MaintainabilityIndex, CyclomaticComplexity = @CyclomaticComplexity, DepthOfInheritance = @DepthOfInheritance, ClassCoupling = @ClassCoupling, LinesOfCode = @LinesOfCode, ResultCode = @ResultCode WHERE BuildId = @BuildId", item); } }
public int Create(Build item) { using (var connection = GetRealTimeConnection()) { connection.Open(); int newId = connection.ExecuteScalar<int>("INSERT INTO [dbo].[Builds] VALUES(@RepositoryId, @BuildDate, @DurationMilliseconds, @DuplicatesFound, @MaintainabilityIndex, @CyclomaticComplexity, @DepthOfInheritance, @ClassCoupling, @LinesOfCode, @ResultCode);SELECT SCOPE_IDENTITY()", item); return newId; } }