Skip to content

Commit

Permalink
#58 necesary to support code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
kccarter76 committed Jul 27, 2020
1 parent 8050371 commit e3115a9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,8 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="src\CodeGenerator\Models\" />
</ItemGroup>

</Project>
21 changes: 21 additions & 0 deletions SubSonic.Core.DataAccessLayer/src/Extensions/ServiceProviders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,30 @@
namespace SubSonic
{
using Linq;
using Microsoft.Extensions.DependencyInjection;
using System.Linq;

public static partial class SubSonicExtensions
{
public static DbContextOptionsBuilder ConfigureServiceCollection(this DbContextOptionsBuilder builder, IServiceCollection services = null)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
IServiceCollection collection = services ?? new ServiceCollection();
if (!Enumerable.Any<ServiceDescriptor>(collection, delegate (ServiceDescriptor service) {
return service.ServiceType == typeof(IServiceCollection);
}))
{
collection.AddSingleton<IServiceCollection, ServiceCollection>(delegate (IServiceProvider provider) {
return (ServiceCollection)collection;
});
}
builder.SetServiceProvider(collection.BuildServiceProvider());
return builder;
}

public static TReturn GetService<TType, TReturn>(this IServiceProvider provider)
{
if (provider is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void ConfigureSubSonic(DbContextOptionsBuilder builder)
throw Error.InvalidOperation(SubSonicErrorMessages.ConfigurationInvalid.Format(nameof(DbContextOptionsBuilder.SetServiceProvider)));
}

IServiceCollection services = Instance.GetService<IServiceCollection>();
IServiceCollection services = Instance?.GetService<IServiceCollection>() ?? new ServiceCollection();

if (services.IsNotNull())
{
Expand Down
42 changes: 0 additions & 42 deletions SubSonic.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SubSonic.Core.DataAccessLayer", "SubSonic.Core.DataAccessLayer\SubSonic.Core.DataAccessLayer.csproj", "{7EE2095A-FB70-4590-B91C-26DA72EEF65F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubSonic.Core.Template", "SubSonic.Core.Template\SubSonic.Core.Template.csproj", "{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubSonic.Core.VisualStudio", "SubSonic.Core.VisualStudio\SubSonic.Core.VisualStudio.csproj", "{817A01DD-7E61-41B8-86C5-57F998A7A520}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubSonic.Core.TemplateWizard", "SubSonic.Core.TemplateWizard\SubSonic.Core.TemplateWizard.csproj", "{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -52,42 +46,6 @@ Global
{7EE2095A-FB70-4590-B91C-26DA72EEF65F}.Release|x64.Build.0 = Release|Any CPU
{7EE2095A-FB70-4590-B91C-26DA72EEF65F}.Release|x86.ActiveCfg = Release|Any CPU
{7EE2095A-FB70-4590-B91C-26DA72EEF65F}.Release|x86.Build.0 = Release|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Debug|x64.ActiveCfg = Debug|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Debug|x64.Build.0 = Debug|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Debug|x86.ActiveCfg = Debug|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Debug|x86.Build.0 = Debug|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Release|Any CPU.Build.0 = Release|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Release|x64.ActiveCfg = Release|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Release|x64.Build.0 = Release|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Release|x86.ActiveCfg = Release|Any CPU
{432D4CE0-CBD6-4E61-81F5-0D995A5CF06F}.Release|x86.Build.0 = Release|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Debug|Any CPU.Build.0 = Debug|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Debug|x64.ActiveCfg = Debug|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Debug|x64.Build.0 = Debug|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Debug|x86.ActiveCfg = Debug|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Debug|x86.Build.0 = Debug|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Release|Any CPU.ActiveCfg = Release|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Release|Any CPU.Build.0 = Release|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Release|x64.ActiveCfg = Release|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Release|x64.Build.0 = Release|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Release|x86.ActiveCfg = Release|Any CPU
{817A01DD-7E61-41B8-86C5-57F998A7A520}.Release|x86.Build.0 = Release|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Debug|x64.ActiveCfg = Debug|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Debug|x64.Build.0 = Debug|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Debug|x86.ActiveCfg = Debug|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Debug|x86.Build.0 = Debug|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Release|Any CPU.Build.0 = Release|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Release|x64.ActiveCfg = Release|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Release|x64.Build.0 = Release|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Release|x86.ActiveCfg = Release|Any CPU
{9BAF9554-BBFE-4B0C-8002-C5333CB69C1E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit e3115a9

Please sign in to comment.