Create DesignTimeFactories for context used on startup with dependencies
This commit is contained in:
parent
a7f51e7d65
commit
d8b374ac4a
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26730.12
|
VisualStudioVersion = 15.0.26730.15
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}"
|
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
@ -126,15 +126,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus.Tests", "src\Build
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.AzureStorage", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj", "{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.AzureStorage", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj", "{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GracePeriodManager", "src\Services\GracePeriod\GracePeriodManager\GracePeriodManager.csproj", "{6C6A69FE-A484-4E75-AFEC-827EA354AF46}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Payment", "Payment", "{D5D3841D-F282-4E60-B9CB-267A1BF2D893}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Payment", "Payment", "{D5D3841D-F282-4E60-B9CB-267A1BF2D893}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{2A795FEA-2EB7-45F5-9B30-35E0810CB238}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{2A795FEA-2EB7-45F5-9B30-35E0810CB238}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebHost", "WebHost", "{3E51A82A-5DE1-482E-BA46-F4FF3138B41A}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebHost", "WebHost", "{3E51A82A-5DE1-482E-BA46-F4FF3138B41A}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "src\BuildingBlocks\WebHostCustomization\WebHost.Customization\WebHost.Customization.csproj", "{BF6AF4F9-684A-4EB3-8CF2-230AA2A03F98}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -1785,54 +1783,6 @@ Global
|
|||||||
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x64.Build.0 = Release|Any CPU
|
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.ActiveCfg = Release|Any CPU
|
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.Build.0 = Release|Any CPU
|
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|ARM.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|ARM.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhone.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x64.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x86.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|ARM.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhone.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|ARM.ActiveCfg = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|ARM.Build.0 = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhone.ActiveCfg = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhone.Build.0 = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
|
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
|
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
|
{2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
|
||||||
@ -1986,7 +1936,6 @@ Global
|
|||||||
{26906157-98E3-4DF8-80F6-866B9686887C} = {B473B70F-0796-4862-B1AD-BB742D93B868}
|
{26906157-98E3-4DF8-80F6-866B9686887C} = {B473B70F-0796-4862-B1AD-BB742D93B868}
|
||||||
{8AE2AAA3-4507-4BEE-9250-4D16F87015B4} = {B473B70F-0796-4862-B1AD-BB742D93B868}
|
{8AE2AAA3-4507-4BEE-9250-4D16F87015B4} = {B473B70F-0796-4862-B1AD-BB742D93B868}
|
||||||
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD} = {96CE8CE7-BC97-4A53-899F-5EB63D7BBF7B}
|
{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD} = {96CE8CE7-BC97-4A53-899F-5EB63D7BBF7B}
|
||||||
{6C6A69FE-A484-4E75-AFEC-827EA354AF46} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B}
|
|
||||||
{D5D3841D-F282-4E60-B9CB-267A1BF2D893} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
|
{D5D3841D-F282-4E60-B9CB-267A1BF2D893} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
|
||||||
{2A795FEA-2EB7-45F5-9B30-35E0810CB238} = {D5D3841D-F282-4E60-B9CB-267A1BF2D893}
|
{2A795FEA-2EB7-45F5-9B30-35E0810CB238} = {D5D3841D-F282-4E60-B9CB-267A1BF2D893}
|
||||||
{3E51A82A-5DE1-482E-BA46-F4FF3138B41A} = {1EF3AC0F-F27C-46DD-AC53-D762D2C11C45}
|
{3E51A82A-5DE1-482E-BA46-F4FF3138B41A} = {1EF3AC0F-F27C-46DD-AC53-D762D2C11C45}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using EntityConfigurations;
|
using EntityConfigurations;
|
||||||
using Model;
|
using Model;
|
||||||
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
|
||||||
public class CatalogContext : DbContext
|
public class CatalogContext : DbContext
|
||||||
{
|
{
|
||||||
@ -20,4 +21,16 @@
|
|||||||
builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration());
|
builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class CatalogContextDesignFactory : IDesignTimeDbContextFactory<CatalogContext>
|
||||||
|
{
|
||||||
|
public CatalogContext CreateDbContext(string[] args)
|
||||||
|
{
|
||||||
|
var optionsBuilder = new DbContextOptionsBuilder<CatalogContext>()
|
||||||
|
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;Integrated Security=true");
|
||||||
|
|
||||||
|
return new CatalogContext(optionsBuilder.Options);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
using EntityConfigurations;
|
using EntityConfigurations;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
|
||||||
|
|
||||||
public class MarketingContext : DbContext
|
public class MarketingContext : DbContext
|
||||||
@ -21,4 +22,15 @@
|
|||||||
builder.ApplyConfiguration(new UserLocationRuleEntityTypeConfiguration());
|
builder.ApplyConfiguration(new UserLocationRuleEntityTypeConfiguration());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MarketingContextDesignFactory : IDesignTimeDbContextFactory<MarketingContext>
|
||||||
|
{
|
||||||
|
public MarketingContext CreateDbContext(string[] args)
|
||||||
|
{
|
||||||
|
var optionsBuilder = new DbContextOptionsBuilder<MarketingContext>()
|
||||||
|
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;Integrated Security=true");
|
||||||
|
|
||||||
|
return new MarketingContext(optionsBuilder.Options);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
|
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
|
||||||
@ -70,4 +71,33 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class OrderingContextDesignFactory : IDesignTimeDbContextFactory<OrderingContext>
|
||||||
|
{
|
||||||
|
public OrderingContext CreateDbContext(string[] args)
|
||||||
|
{
|
||||||
|
var optionsBuilder = new DbContextOptionsBuilder<OrderingContext>()
|
||||||
|
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;Integrated Security=true");
|
||||||
|
|
||||||
|
return new OrderingContext(optionsBuilder.Options,new NoMediator());
|
||||||
|
}
|
||||||
|
|
||||||
|
class NoMediator : IMediator
|
||||||
|
{
|
||||||
|
public Task Publish<TNotification>(TNotification notification, CancellationToken cancellationToken = default(CancellationToken)) where TNotification : INotification
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<TResponse> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
{
|
||||||
|
return Task.FromResult<TResponse>(default(TResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task Send(IRequest request, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user