using System; using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; using Volo.Abp.Guids; namespace Acme.BookStore { public class BookStoreTestDataSeedContributor : IDataSeedContributor, ITransientDependency { private readonly IRepository _bookRepository; private readonly IGuidGenerator _guidGenerator; public BookStoreTestDataSeedContributor( IRepository bookRepository, IGuidGenerator guidGenerator) { _bookRepository = bookRepository; _guidGenerator = guidGenerator; } public async Task SeedAsync(DataSeedContext context) { await _bookRepository.InsertAsync( new Book(_guidGenerator.Create(), "Test book 1", BookType.Fantastic, new DateTime(2015, 05, 24), 21) ); await _bookRepository.InsertAsync( new Book(_guidGenerator.Create(), "Test book 2", BookType.Science, new DateTime(2014, 02, 11), 15) ); } } }