private static async Task ReadComments(SqlTransaction transaction, SqlConnection connection, string postId, string filterPostId, IMongoDBWrapper wrapper) { while (true) { // Read from Mongo var nextComment = await wrapper.GetNextComment(filterPostId); if (nextComment == null) { break; } // Write To Sql Server string sql = "INSERT INTO Comment " + "(Text, PostId) " + "VALUES " + "(@text, @postId)"; var result = await connection.ExecuteAsync(sql, new { text = nextComment.Text, postId = postId }, transaction); } }
public PostController(IMongoDBWrapper mongoDBWrapper) { _mongoDBWrapper = mongoDBWrapper; }
public CommentController(IMongoDBWrapper mongoDBWrapper) { _mongoDBWrapper = mongoDBWrapper; }