Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
5f644b8131
@ -42,7 +42,7 @@ namespace eShopOnContainers.Core.ViewModels.Base
|
||||
{
|
||||
_container = new TinyIoCContainer();
|
||||
|
||||
// View models
|
||||
// View models - by default, TinyIoC will register concrete classes as multi-instance.
|
||||
_container.Register<BasketViewModel>();
|
||||
_container.Register<CatalogViewModel>();
|
||||
_container.Register<CheckoutViewModel>();
|
||||
@ -54,21 +54,21 @@ namespace eShopOnContainers.Core.ViewModels.Base
|
||||
_container.Register<CampaignViewModel>();
|
||||
_container.Register<CampaignDetailsViewModel>();
|
||||
|
||||
// Services
|
||||
_container.Register<INavigationService, NavigationService>().AsSingleton();
|
||||
// Services - by default, TinyIoC will register interface registrations as singletons.
|
||||
_container.Register<INavigationService, NavigationService>();
|
||||
_container.Register<IDialogService, DialogService>();
|
||||
_container.Register<IOpenUrlService, OpenUrlService>();
|
||||
_container.Register<IIdentityService, IdentityService>();
|
||||
_container.Register<IRequestProvider, RequestProvider>();
|
||||
_container.Register<IDependencyService, Services.Dependency.DependencyService>();
|
||||
_container.Register<ISettingsService, SettingsService>().AsSingleton();
|
||||
_container.Register<IFixUriService, FixUriService>().AsSingleton();
|
||||
_container.Register<ILocationService, LocationService>().AsSingleton();
|
||||
_container.Register<ICatalogService, CatalogMockService>().AsSingleton();
|
||||
_container.Register<IBasketService, BasketMockService>().AsSingleton();
|
||||
_container.Register<IOrderService, OrderMockService>().AsSingleton();
|
||||
_container.Register<IUserService, UserMockService>().AsSingleton();
|
||||
_container.Register<ICampaignService, CampaignMockService>().AsSingleton();
|
||||
_container.Register<ISettingsService, SettingsService>();
|
||||
_container.Register<IFixUriService, FixUriService>();
|
||||
_container.Register<ILocationService, LocationService>();
|
||||
_container.Register<ICatalogService, CatalogMockService>();
|
||||
_container.Register<IBasketService, BasketMockService>();
|
||||
_container.Register<IOrderService, OrderMockService>();
|
||||
_container.Register<IUserService, UserMockService>();
|
||||
_container.Register<ICampaignService, CampaignMockService>();
|
||||
}
|
||||
|
||||
public static void UpdateDependencies(bool useMockServices)
|
||||
@ -76,21 +76,21 @@ namespace eShopOnContainers.Core.ViewModels.Base
|
||||
// Change injected dependencies
|
||||
if (useMockServices)
|
||||
{
|
||||
_container.Register<ICatalogService, CatalogMockService>().AsSingleton();
|
||||
_container.Register<IBasketService, BasketMockService>().AsSingleton();
|
||||
_container.Register<IOrderService, OrderMockService>().AsSingleton();
|
||||
_container.Register<IUserService, UserMockService>().AsSingleton();
|
||||
_container.Register<ICampaignService, CampaignMockService>().AsSingleton();
|
||||
_container.Register<ICatalogService, CatalogMockService>();
|
||||
_container.Register<IBasketService, BasketMockService>();
|
||||
_container.Register<IOrderService, OrderMockService>();
|
||||
_container.Register<IUserService, UserMockService>();
|
||||
_container.Register<ICampaignService, CampaignMockService>();
|
||||
|
||||
UseMockService = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_container.Register<ICatalogService, CatalogService>().AsSingleton();
|
||||
_container.Register<IBasketService, BasketService>().AsSingleton();
|
||||
_container.Register<IOrderService, OrderService>().AsSingleton();
|
||||
_container.Register<IUserService, UserService>().AsSingleton();
|
||||
_container.Register<ICampaignService, CampaignService>().AsSingleton();
|
||||
_container.Register<ICatalogService, CatalogService>();
|
||||
_container.Register<IBasketService, BasketService>();
|
||||
_container.Register<IOrderService, OrderService>();
|
||||
_container.Register<IUserService, UserService>();
|
||||
_container.Register<ICampaignService, CampaignService>();
|
||||
|
||||
UseMockService = false;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
if (!context.CatalogBrands.Any())
|
||||
{
|
||||
context.CatalogBrands.AddRange(useCustomizationData
|
||||
await context.CatalogBrands.AddRangeAsync(useCustomizationData
|
||||
? GetCatalogBrandsFromFile(contentRootPath, logger)
|
||||
: GetPreconfiguredCatalogBrands());
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
if (!context.CatalogTypes.Any())
|
||||
{
|
||||
context.CatalogTypes.AddRange(useCustomizationData
|
||||
await context.CatalogTypes.AddRangeAsync(useCustomizationData
|
||||
? GetCatalogTypesFromFile(contentRootPath, logger)
|
||||
: GetPreconfiguredCatalogTypes());
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
if (!context.CatalogItems.Any())
|
||||
{
|
||||
context.CatalogItems.AddRange(useCustomizationData
|
||||
await context.CatalogItems.AddRangeAsync(useCustomizationData
|
||||
? GetCatalogItemsFromFile(contentRootPath, context, logger)
|
||||
: GetPreconfiguredItems());
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
|
||||
|
||||
if (!context.Users.Any())
|
||||
{
|
||||
context.Users.AddRange(useCustomizationData
|
||||
await context.Users.AddRangeAsync(useCustomizationData
|
||||
? GetUsersFromFile(contentRootPath, logger)
|
||||
: GetDefaultUser());
|
||||
|
||||
|
@ -27,17 +27,17 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
|
||||
|
||||
if (!await context.Clients.AnyAsync())
|
||||
{
|
||||
context.Clients.AddRange(Config.GetClients(clientUrls).Select(client => client.ToEntity()));
|
||||
await context.Clients.AddRangeAsync(Config.GetClients(clientUrls).Select(client => client.ToEntity()));
|
||||
}
|
||||
|
||||
if (!await context.IdentityResources.AnyAsync())
|
||||
{
|
||||
context.IdentityResources.AddRange(Config.GetResources().Select(resource => resource.ToEntity()));
|
||||
await context.IdentityResources.AddRangeAsync(Config.GetResources().Select(resource => resource.ToEntity()));
|
||||
}
|
||||
|
||||
if (!await context.ApiResources.AnyAsync())
|
||||
{
|
||||
context.ApiResources.AddRange(Config.GetApis().Select(api => api.ToEntity()));
|
||||
await context.ApiResources.AddRangeAsync(Config.GetApis().Select(api => api.ToEntity()));
|
||||
}
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
|
@ -19,7 +19,7 @@
|
||||
{
|
||||
if (!context.Campaigns.Any())
|
||||
{
|
||||
context.Campaigns.AddRange(
|
||||
await context.Campaigns.AddRangeAsync(
|
||||
GetPreconfiguredMarketings());
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
|
@ -19,11 +19,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
||||
builder.RegisterAssemblyTypes(typeof(IMediator).GetTypeInfo().Assembly)
|
||||
.AsImplementedInterfaces();
|
||||
|
||||
// Register all the Command classes (they implement IAsyncRequestHandler) in assembly holding the Commands
|
||||
// Register all the Command classes (they implement IRequestHandler) in assembly holding the Commands
|
||||
builder.RegisterAssemblyTypes(typeof(CreateOrderCommand).GetTypeInfo().Assembly)
|
||||
.AsClosedTypesOf(typeof(IRequestHandler<,>));
|
||||
|
||||
// Register the DomainEventHandler classes (they implement IAsyncNotificationHandler<>) in assembly holding the Domain Events
|
||||
// Register the DomainEventHandler classes (they implement INotificationHandler<>) in assembly holding the Domain Events
|
||||
builder.RegisterAssemblyTypes(typeof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler).GetTypeInfo().Assembly)
|
||||
.AsClosedTypesOf(typeof(INotificationHandler<>));
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
if (!context.CardTypes.Any())
|
||||
{
|
||||
context.CardTypes.AddRange(useCustomizationData
|
||||
await context.CardTypes.AddRangeAsync(useCustomizationData
|
||||
? GetCardTypesFromFile(contentRootPath, logger)
|
||||
: GetPredefinedCardTypes());
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
if (!context.OrderStatus.Any())
|
||||
{
|
||||
context.OrderStatus.AddRange(useCustomizationData
|
||||
await context.OrderStatus.AddRangeAsync(useCustomizationData
|
||||
? GetOrderStatusFromFile(contentRootPath, logger)
|
||||
: GetPredefinedOrderStatus());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user