mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
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<Book, Guid> _bookRepository;
|
|
private readonly IGuidGenerator _guidGenerator;
|
|
|
|
public BookStoreTestDataSeedContributor(
|
|
IRepository<Book, Guid> bookRepository,
|
|
IGuidGenerator guidGenerator)
|
|
{
|
|
_bookRepository = bookRepository;
|
|
_guidGenerator = guidGenerator;
|
|
}
|
|
|
|
public async Task SeedAsync(DataSeedContext context)
|
|
{
|
|
await _bookRepository.InsertAsync(
|
|
new Book
|
|
{
|
|
Id = _guidGenerator.Create(),
|
|
Name = "Test book 1",
|
|
Type = BookType.Fantastic,
|
|
PublishDate = new DateTime(2015, 05, 24),
|
|
Price = 21
|
|
}
|
|
);
|
|
|
|
await _bookRepository.InsertAsync(
|
|
new Book
|
|
{
|
|
Id = _guidGenerator.Create(),
|
|
Name = "Test book 2",
|
|
Type = BookType.Science,
|
|
PublishDate = new DateTime(2014, 02, 11),
|
|
Price = 15
|
|
}
|
|
);
|
|
}
|
|
}
|
|
}
|