mirror of https://github.com/abpframework/abp.git
committed by
GitHub
362 changed files with 50134 additions and 6087 deletions
@ -1,20 +1,21 @@ |
|||||
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Brand |
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Brand |
||||
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Menu |
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Menu |
||||
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar |
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar |
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top" id="main-navbar"> |
<nav class="navbar navbar-expand-md navbar-dark bg-dark shadow-sm flex-column flex-md-row mb-4" id="main-navbar" style="min-height: 4rem;"> |
||||
@(await Component.InvokeAsync<MainNavbarBrandViewComponent>()) |
<div class="container"> |
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" |
@(await Component.InvokeAsync<MainNavbarBrandViewComponent>()) |
||||
data-target="#main-navbar-collapse" aria-controls="main-navbar-collapse" |
<button class="navbar-toggler" type="button" data-toggle="collapse" |
||||
aria-expanded="false" aria-label="Toggle navigation"> |
data-target="#main-navbar-collapse" aria-controls="main-navbar-collapse" |
||||
<span class="navbar-toggler-icon"></span> |
aria-expanded="false" aria-label="Toggle navigation"> |
||||
</button> |
<span class="navbar-toggler-icon"></span> |
||||
<div class="collapse navbar-collapse" id="main-navbar-collapse"> |
</button> |
||||
<ul class="navbar-nav mr-auto"> |
<div class="collapse navbar-collapse" id="main-navbar-collapse"> |
||||
@(await Component.InvokeAsync<MainNavbarMenuViewComponent>()) |
<ul class="navbar-nav mx-auto"> |
||||
</ul> |
@(await Component.InvokeAsync<MainNavbarMenuViewComponent>()) |
||||
|
</ul> |
||||
<span id="main-navbar-tools"> |
<ul class="navbar-nav"> |
||||
@(await Component.InvokeAsync<MainNavbarToolbarViewComponent>()) |
@(await Component.InvokeAsync<MainNavbarToolbarViewComponent>()) |
||||
</span> |
</ul> |
||||
|
</div> |
||||
</div> |
</div> |
||||
</nav> |
</nav> |
||||
@ -1,36 +1,59 @@ |
|||||
body { |
|
||||
padding-top: 5rem; |
|
||||
} |
|
||||
|
|
||||
body.abp-empty-layout { |
|
||||
padding-top: 0; |
|
||||
} |
|
||||
|
|
||||
#main-navbar-tools a.dropdown-toggle { |
#main-navbar-tools a.dropdown-toggle { |
||||
text-decoration: none; |
text-decoration: none; |
||||
color: #fff; |
color: #fff; |
||||
} |
} |
||||
|
|
||||
/* Main Menu */ |
|
||||
|
|
||||
.navbar .dropdown-submenu { |
.navbar .dropdown-submenu { |
||||
position: relative; |
position: relative; |
||||
} |
} |
||||
|
.navbar .dropdown-menu { |
||||
.navbar .dropdown-submenu a { |
margin: 0; |
||||
padding: 0.25rem 1.4rem; |
padding: 0; |
||||
|
} |
||||
|
.navbar .dropdown-menu a { |
||||
|
font-size: .9em; |
||||
|
padding: 10px 15px; |
||||
|
display: block; |
||||
|
min-width: 210px; |
||||
|
text-align: left; |
||||
|
border-radius: 0.25rem; |
||||
|
min-height: 44px; |
||||
} |
} |
||||
|
.navbar .dropdown-submenu a::after { |
||||
|
transform: rotate(-90deg); |
||||
|
position: absolute; |
||||
|
right: 16px; |
||||
|
top: 18px; |
||||
|
} |
||||
|
.navbar .dropdown-submenu .dropdown-menu { |
||||
|
top: 0; |
||||
|
left: 100%; |
||||
|
} |
||||
|
|
||||
|
.card-header .btn { |
||||
|
padding: 2px 6px; |
||||
|
} |
||||
|
.card-header h5 { |
||||
|
margin: 0; |
||||
|
} |
||||
|
.container > .card { |
||||
|
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; |
||||
|
} |
||||
|
|
||||
.navbar .dropdown-submenu a::after { |
@media screen and (min-width: 768px) { |
||||
transform: rotate(-90deg); |
.navbar .dropdown:hover > .dropdown-menu { |
||||
position: absolute; |
display: block; |
||||
right: 16px; |
} |
||||
top: 18px; |
|
||||
} |
|
||||
|
|
||||
.navbar .dropdown-submenu .dropdown-menu { |
.navbar .dropdown-submenu:hover > .dropdown-menu { |
||||
top: 0; |
display: block; |
||||
left: 100%; |
|
||||
margin-left: .1rem; |
|
||||
margin-right: .1rem; |
|
||||
} |
} |
||||
|
} |
||||
|
.input-validation-error { |
||||
|
border-color: #dc3545; |
||||
|
} |
||||
|
.field-validation-error { |
||||
|
font-size: 0.8em; |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,20 @@ |
|||||
|
using System.Linq; |
||||
|
using System.Reflection; |
||||
|
using Microsoft.AspNetCore.Mvc.ApplicationParts; |
||||
|
|
||||
|
namespace Microsoft.Extensions.DependencyInjection |
||||
|
{ |
||||
|
public static class AbpMvcBuilderExtensions |
||||
|
{ |
||||
|
public static void AddApplicationPartIfNotExists(this IMvcBuilder mvcBuilder, Assembly assembly) |
||||
|
{ |
||||
|
if (mvcBuilder.PartManager.ApplicationParts.Any( |
||||
|
p => p is AssemblyPart assemblyPart && assemblyPart.Assembly == assembly)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(assembly)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,63 +0,0 @@ |
|||||
using System; |
|
||||
|
|
||||
namespace Microsoft.AspNetCore.InProcess |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// https://github.com/aspnet/AspNetCore.Docs/blob/master/aspnetcore/host-and-deploy/aspnet-core-module/samples_snapshot/2.x/CurrentDirectoryHelpers.cs
|
|
||||
/// TODO: Remove CurrentDirectoryHelpers.cs when upgrade to ASP.NET Core 3.0.
|
|
||||
/// </summary>
|
|
||||
public class CurrentDirectoryHelpers |
|
||||
{ |
|
||||
internal const string AspNetCoreModuleDll = "aspnetcorev2_inprocess.dll"; |
|
||||
|
|
||||
[System.Runtime.InteropServices.DllImport("kernel32.dll")] |
|
||||
private static extern IntPtr GetModuleHandle(string lpModuleName); |
|
||||
|
|
||||
[System.Runtime.InteropServices.DllImport(AspNetCoreModuleDll)] |
|
||||
private static extern int http_get_application_properties(ref IISConfigurationData iiConfigData); |
|
||||
|
|
||||
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)] |
|
||||
private struct IISConfigurationData |
|
||||
{ |
|
||||
public IntPtr pNativeApplication; |
|
||||
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)] |
|
||||
public string pwzFullApplicationPath; |
|
||||
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)] |
|
||||
public string pwzVirtualApplicationPath; |
|
||||
public bool fWindowsAuthEnabled; |
|
||||
public bool fBasicAuthEnabled; |
|
||||
public bool fAnonymousAuthEnable; |
|
||||
} |
|
||||
|
|
||||
public static void SetCurrentDirectory() |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
// Check if physical path was provided by ANCM
|
|
||||
var sitePhysicalPath = Environment.GetEnvironmentVariable("ASPNETCORE_IIS_PHYSICAL_PATH"); |
|
||||
if (string.IsNullOrEmpty(sitePhysicalPath)) |
|
||||
{ |
|
||||
// Skip if not running ANCM InProcess
|
|
||||
if (GetModuleHandle(AspNetCoreModuleDll) == IntPtr.Zero) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
IISConfigurationData configurationData = default(IISConfigurationData); |
|
||||
if (http_get_application_properties(ref configurationData) != 0) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
sitePhysicalPath = configurationData.pwzFullApplicationPath; |
|
||||
} |
|
||||
|
|
||||
Environment.CurrentDirectory = sitePhysicalPath; |
|
||||
} |
|
||||
catch |
|
||||
{ |
|
||||
// ignore
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,10 +1,19 @@ |
|||||
@page |
@page |
||||
@model Volo.Abp.Account.Web.Pages.Account.RegisterModel |
@model Volo.Abp.Account.Web.Pages.Account.RegisterModel |
||||
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage |
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage |
||||
<h2>@L["Register"]</h2> |
|
||||
<form method="post"> |
<div class="card mt-3 shadow-sm rounded"> |
||||
<abp-input asp-for="Input.UserName" auto-focus="true" /> |
<div class="card-body p-5"> |
||||
<abp-input asp-for="Input.EmailAddress" /> |
<h4>@L["Register"]</h4> |
||||
<abp-input asp-for="Input.Password" /> |
<strong> |
||||
<abp-button button-type="Primary" type="submit">@L["Register"]</abp-button> |
Already registered? |
||||
</form> |
<a href="@Url.Page("./Login", new {returnUrl = Model.ReturnUrl, returnUrlHash = Model.ReturnUrlHash})" class="text-decoration-none">@L["Login"]</a> |
||||
|
</strong> |
||||
|
<form method="post" class="mt-4"> |
||||
|
<abp-input asp-for="Input.UserName" auto-focus="true" /> |
||||
|
<abp-input asp-for="Input.EmailAddress" /> |
||||
|
<abp-input asp-for="Input.Password" /> |
||||
|
<abp-button button-type="Primary" type="submit" class="btn-lg btn-block mt-4">@L["Register"]</abp-button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
|||||
@ -1,7 +1,23 @@ |
|||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
||||
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/@KeyIndexDefined">True</s:Boolean> |
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean> |
||||
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/AbsolutePath/@EntryValue">D:\github\abp\common.DotSettings</s:String> |
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/RelativePath/@EntryValue">..\..\..\common.DotSettings</s:String> |
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceFixedStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File59923913AE66194DB837F628B1FC08BE/@KeyIndexDefined">True</s:Boolean> |
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForeachStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File59923913AE66194DB837F628B1FC08BE/RelativePriority/@EntryValue">1</s:Double> |
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceIfStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceLockStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceUsingStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceWhileStatementBraces/@EntryIndexedValue">WARNING</s:String> |
||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">Required</s:String> |
||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOREACH/@EntryValue">Required</s:String> |
||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_IFELSE/@EntryValue">Required</s:String> |
||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_WHILE/@EntryValue">Required</s:String> |
||||
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_REDUNDANT/@EntryValue">False</s:Boolean> |
||||
|
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean> |
||||
|
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Async/@EntryIndexedValue">False</s:String> |
||||
|
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Mutable/@EntryIndexedValue">False</s:String> |
||||
|
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean> |
||||
|
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String> |
||||
|
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String> |
||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String> |
||||
</wpf:ResourceDictionary> |
</wpf:ResourceDictionary> |
||||
@ -1,46 +0,0 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.DependencyInjection; |
|
||||
using Volo.Abp.Domain.Repositories; |
|
||||
|
|
||||
namespace Acme.BookStore |
|
||||
{ |
|
||||
public class BookStoreDataSeederContributor : IDataSeedContributor, ITransientDependency |
|
||||
{ |
|
||||
private readonly IRepository<Book, Guid> _bookRepository; |
|
||||
|
|
||||
public BookStoreDataSeederContributor(IRepository<Book, Guid> bookRepository) |
|
||||
{ |
|
||||
_bookRepository = bookRepository; |
|
||||
} |
|
||||
|
|
||||
public async Task SeedAsync(DataSeedContext context) |
|
||||
{ |
|
||||
if (await _bookRepository.GetCountAsync() > 0) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
await _bookRepository.InsertAsync( |
|
||||
new Book |
|
||||
{ |
|
||||
Name = "1984", |
|
||||
Type = BookType.Dystopia, |
|
||||
PublishDate = new DateTime(1949, 6, 8), |
|
||||
Price = 19.84f |
|
||||
} |
|
||||
); |
|
||||
|
|
||||
await _bookRepository.InsertAsync( |
|
||||
new Book |
|
||||
{ |
|
||||
Name = "The Hitchhiker's Guide to the Galaxy", |
|
||||
Type = BookType.ScienceFiction, |
|
||||
PublishDate = new DateTime(1995, 9, 27), |
|
||||
Price = 42.0f |
|
||||
} |
|
||||
); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +1,12 @@ |
|||||
{ |
{ |
||||
"App": { |
"App": { |
||||
"SelfUrl": "https://localhost:44359", |
"SelfUrl": "https://localhost:44341", |
||||
"CorsOrigins": "https://*.BookStore.com,http://localhost:4200" |
"CorsOrigins": "https://*.BookStore.com,http://localhost:4200" |
||||
}, |
}, |
||||
"ConnectionStrings": { |
"ConnectionStrings": { |
||||
"Default": "mongodb://localhost:27017/BookStore" |
"Default": "mongodb://localhost:27017/BookStore" |
||||
}, |
}, |
||||
"Redis": { |
|
||||
"Configuration": "127.0.0.1" |
|
||||
}, |
|
||||
"AuthServer": { |
"AuthServer": { |
||||
"Authority": "https://localhost:44359" |
"Authority": "https://localhost:44341" |
||||
} |
} |
||||
} |
} |
||||
|
|||||
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,72 +0,0 @@ |
|||||
using System; |
|
||||
using System.Linq; |
|
||||
using System.Threading.Tasks; |
|
||||
using Shouldly; |
|
||||
using Volo.Abp.Application.Dtos; |
|
||||
using Volo.Abp.Validation; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace Acme.BookStore |
|
||||
{ |
|
||||
public class BookAppService_Tests : BookStoreApplicationTestBase |
|
||||
{ |
|
||||
private readonly IBookAppService _bookAppService; |
|
||||
|
|
||||
public BookAppService_Tests() |
|
||||
{ |
|
||||
_bookAppService = GetRequiredService<IBookAppService>(); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public async Task Should_Get_List_Of_Books() |
|
||||
{ |
|
||||
//Act
|
|
||||
var result = await _bookAppService.GetListAsync( |
|
||||
new PagedAndSortedResultRequestDto() |
|
||||
); |
|
||||
|
|
||||
//Assert
|
|
||||
result.TotalCount.ShouldBeGreaterThan(0); |
|
||||
result.Items.ShouldContain(b => b.Name == "Test book 1"); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public async Task Should_Create_A_Valid_Book() |
|
||||
{ |
|
||||
//Act
|
|
||||
var result = await _bookAppService.CreateAsync( |
|
||||
new CreateUpdateBookDto |
|
||||
{ |
|
||||
Name = "New test book 42", |
|
||||
Price = 10, |
|
||||
PublishDate = DateTime.Now, |
|
||||
Type = BookType.ScienceFiction |
|
||||
} |
|
||||
); |
|
||||
|
|
||||
//Assert
|
|
||||
result.Id.ShouldNotBe(Guid.Empty); |
|
||||
result.Name.ShouldBe("New test book 42"); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public async Task Should_Not_Create_A_Book_Without_Name() |
|
||||
{ |
|
||||
var exception = await Assert.ThrowsAsync<AbpValidationException>(async () => |
|
||||
{ |
|
||||
await _bookAppService.CreateAsync( |
|
||||
new CreateUpdateBookDto |
|
||||
{ |
|
||||
Name = "", |
|
||||
Price = 10, |
|
||||
PublishDate = DateTime.Now, |
|
||||
Type = BookType.ScienceFiction |
|
||||
} |
|
||||
); |
|
||||
}); |
|
||||
|
|
||||
exception.ValidationErrors |
|
||||
.ShouldContain(err => err.MemberNames.Any(mem => mem == "Name")); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,17 +1,17 @@ |
|||||
{ |
{ |
||||
"RemoteServices": { |
"RemoteServices": { |
||||
"Default": { |
"Default": { |
||||
"BaseUrl": "https://localhost:44351" |
"BaseUrl": "https://localhost:44341" |
||||
} |
} |
||||
}, |
}, |
||||
"IdentityClients": { |
"IdentityClients": { |
||||
"Default": { |
"Default": { |
||||
"GrantType": "password", |
"GrantType": "password", |
||||
"ClientId": "BookStore_ConsoleTestApp", |
"ClientId": "BookStore_App", |
||||
"ClientSecret": "1q2w3e*", |
"ClientSecret": "1q2w3e*", |
||||
"UserName": "admin", |
"UserName": "admin", |
||||
"UserPassword": "1q2w3E*", |
"UserPassword": "1q2w3E*", |
||||
"Authority": "https://localhost:44331", |
"Authority": "https://localhost:44341", |
||||
"Scope": "BookStore" |
"Scope": "BookStore" |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,49 +1,16 @@ |
|||||
using System; |
using System.Threading.Tasks; |
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Data; |
using Volo.Abp.Data; |
||||
using Volo.Abp.DependencyInjection; |
using Volo.Abp.DependencyInjection; |
||||
using Volo.Abp.Domain.Repositories; |
|
||||
using Volo.Abp.Guids; |
|
||||
|
|
||||
namespace Acme.BookStore |
namespace Acme.BookStore |
||||
{ |
{ |
||||
public class BookStoreTestDataSeedContributor |
public class BookStoreTestDataSeedContributor : IDataSeedContributor, ITransientDependency |
||||
: IDataSeedContributor, ITransientDependency |
|
||||
{ |
{ |
||||
private readonly IRepository<Book, Guid> _bookRepository; |
public Task SeedAsync(DataSeedContext context) |
||||
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( |
/* Seed additional test data... */ |
||||
new Book |
|
||||
{ |
|
||||
Id = _guidGenerator.Create(), |
|
||||
Name = "Test book 1", |
|
||||
Type = BookType.Fantastic, |
|
||||
PublishDate = new DateTime(2015, 05, 24), |
|
||||
Price = 21 |
|
||||
} |
|
||||
); |
|
||||
|
|
||||
await _bookRepository.InsertAsync( |
return Task.CompletedTask; |
||||
new Book |
|
||||
{ |
|
||||
Id = _guidGenerator.Create(), |
|
||||
Name = "Test book 2", |
|
||||
Type = BookType.Science, |
|
||||
PublishDate = new DateTime(2014, 02, 11), |
|
||||
Price = 15 |
|
||||
} |
|
||||
); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue