Browse Source

Merge remote-tracking branch 'upstream/dev' into dev

pull/529/head
Robert Raboud 7 years ago
parent
commit
5f644b8131
7 changed files with 33 additions and 33 deletions
  1. +21
    -21
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ViewModelLocator.cs
  2. +3
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  3. +1
    -1
      src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs
  4. +3
    -3
      src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
  5. +1
    -1
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs
  6. +2
    -2
      src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs
  7. +2
    -2
      src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs

+ 21
- 21
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ViewModelLocator.cs View File

@ -42,7 +42,7 @@ namespace eShopOnContainers.Core.ViewModels.Base
{ {
_container = new TinyIoCContainer(); _container = new TinyIoCContainer();
// View models
// View models - by default, TinyIoC will register concrete classes as multi-instance.
_container.Register<BasketViewModel>(); _container.Register<BasketViewModel>();
_container.Register<CatalogViewModel>(); _container.Register<CatalogViewModel>();
_container.Register<CheckoutViewModel>(); _container.Register<CheckoutViewModel>();
@ -54,21 +54,21 @@ namespace eShopOnContainers.Core.ViewModels.Base
_container.Register<CampaignViewModel>(); _container.Register<CampaignViewModel>();
_container.Register<CampaignDetailsViewModel>(); _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<IDialogService, DialogService>();
_container.Register<IOpenUrlService, OpenUrlService>(); _container.Register<IOpenUrlService, OpenUrlService>();
_container.Register<IIdentityService, IdentityService>(); _container.Register<IIdentityService, IdentityService>();
_container.Register<IRequestProvider, RequestProvider>(); _container.Register<IRequestProvider, RequestProvider>();
_container.Register<IDependencyService, Services.Dependency.DependencyService>(); _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) public static void UpdateDependencies(bool useMockServices)
@ -76,21 +76,21 @@ namespace eShopOnContainers.Core.ViewModels.Base
// Change injected dependencies // Change injected dependencies
if (useMockServices) 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; UseMockService = true;
} }
else 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; UseMockService = false;
} }


+ 3
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -30,7 +30,7 @@
if (!context.CatalogBrands.Any()) if (!context.CatalogBrands.Any())
{ {
context.CatalogBrands.AddRange(useCustomizationData
await context.CatalogBrands.AddRangeAsync(useCustomizationData
? GetCatalogBrandsFromFile(contentRootPath, logger) ? GetCatalogBrandsFromFile(contentRootPath, logger)
: GetPreconfiguredCatalogBrands()); : GetPreconfiguredCatalogBrands());
@ -39,7 +39,7 @@
if (!context.CatalogTypes.Any()) if (!context.CatalogTypes.Any())
{ {
context.CatalogTypes.AddRange(useCustomizationData
await context.CatalogTypes.AddRangeAsync(useCustomizationData
? GetCatalogTypesFromFile(contentRootPath, logger) ? GetCatalogTypesFromFile(contentRootPath, logger)
: GetPreconfiguredCatalogTypes()); : GetPreconfiguredCatalogTypes());
@ -48,7 +48,7 @@
if (!context.CatalogItems.Any()) if (!context.CatalogItems.Any())
{ {
context.CatalogItems.AddRange(useCustomizationData
await context.CatalogItems.AddRangeAsync(useCustomizationData
? GetCatalogItemsFromFile(contentRootPath, context, logger) ? GetCatalogItemsFromFile(contentRootPath, context, logger)
: GetPreconfiguredItems()); : GetPreconfiguredItems());


+ 1
- 1
src/Services/Identity/Identity.API/Data/ApplicationDbContextSeed.cs View File

@ -33,7 +33,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
if (!context.Users.Any()) if (!context.Users.Any())
{ {
context.Users.AddRange(useCustomizationData
await context.Users.AddRangeAsync(useCustomizationData
? GetUsersFromFile(contentRootPath, logger) ? GetUsersFromFile(contentRootPath, logger)
: GetDefaultUser()); : GetDefaultUser());


+ 3
- 3
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs View File

@ -27,17 +27,17 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
if (!await context.Clients.AnyAsync()) 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()) 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()) 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(); await context.SaveChangesAsync();


+ 1
- 1
src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs View File

@ -19,7 +19,7 @@
{ {
if (!context.Campaigns.Any()) if (!context.Campaigns.Any())
{ {
context.Campaigns.AddRange(
await context.Campaigns.AddRangeAsync(
GetPreconfiguredMarketings()); GetPreconfiguredMarketings());
await context.SaveChangesAsync(); await context.SaveChangesAsync();


+ 2
- 2
src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs View File

@ -19,11 +19,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
builder.RegisterAssemblyTypes(typeof(IMediator).GetTypeInfo().Assembly) builder.RegisterAssemblyTypes(typeof(IMediator).GetTypeInfo().Assembly)
.AsImplementedInterfaces(); .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) builder.RegisterAssemblyTypes(typeof(CreateOrderCommand).GetTypeInfo().Assembly)
.AsClosedTypesOf(typeof(IRequestHandler<,>)); .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) builder.RegisterAssemblyTypes(typeof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler).GetTypeInfo().Assembly)
.AsClosedTypesOf(typeof(INotificationHandler<>)); .AsClosedTypesOf(typeof(INotificationHandler<>));


+ 2
- 2
src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs View File

@ -39,7 +39,7 @@
if (!context.CardTypes.Any()) if (!context.CardTypes.Any())
{ {
context.CardTypes.AddRange(useCustomizationData
await context.CardTypes.AddRangeAsync(useCustomizationData
? GetCardTypesFromFile(contentRootPath, logger) ? GetCardTypesFromFile(contentRootPath, logger)
: GetPredefinedCardTypes()); : GetPredefinedCardTypes());
@ -48,7 +48,7 @@
if (!context.OrderStatus.Any()) if (!context.OrderStatus.Any())
{ {
context.OrderStatus.AddRange(useCustomizationData
await context.OrderStatus.AddRangeAsync(useCustomizationData
? GetOrderStatusFromFile(contentRootPath, logger) ? GetOrderStatusFromFile(contentRootPath, logger)
: GetPredefinedOrderStatus()); : GetPredefinedOrderStatus());
} }


Loading…
Cancel
Save