protected override void Act() { using (Reader) { Document = CsvDocument.CreateFrom(Reader, Options); } }
private static void SeedComments(StoryBlogDbContext context, Assembly resourceAssembly, ILogger logger) { var resource = resourceAssembly.GetManifestResourceStream("StoryBlog.Web.Services.Blog.API.Data.Comments.csv"); using (var reader = new StreamReader(resource, Encoding.UTF8)) { var document = CsvDocument.CreateFrom(reader); using (var transaction = context.Database.BeginTransaction()) { foreach (var row in document.Rows) { var comment = CreateCommentFromRow(context, row); logger.LogDebug($"[SeedComment] Comment \'{comment.Id}\' created"); } transaction.Commit(); } } }