Browse Source

Fixed #698: Conflict for ConfigurationHelper

pull/705/head
Halil ibrahim Kalkan 8 years ago
parent
commit
c624eac412
  1. 6
      modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj
  2. 37
      modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/ConfigurationHelper.cs
  3. 13
      modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/DemoAppModule.cs
  4. 6
      modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj

6
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj

@ -11,5 +11,11 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.BackgroundJobs.HangFire\Volo.Abp.BackgroundJobs.HangFire.csproj" />
<ProjectReference Include="..\Volo.Abp.BackgroundJobs.DemoApp.Shared\Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

37
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/ConfigurationHelper.cs

@ -1,37 +0,0 @@
using System.IO;
using Microsoft.Extensions.Configuration;
namespace Volo.Abp.BackgroundJobs.DemoApp.Shared
{
public static class ConfigurationHelper
{
public static IConfigurationRoot BuildConfiguration()
{
const string fileName = "appsettings.json";
var directory = Directory.GetCurrentDirectory();
while (!File.Exists(Path.Combine(directory, fileName)))
{
var parentDirectory = new DirectoryInfo(directory).Parent;
if (parentDirectory == null)
{
break;
}
directory = parentDirectory.FullName;
}
if (File.Exists(Path.Combine(directory, fileName)))
{
var builder = new ConfigurationBuilder()
.SetBasePath(directory)
.AddJsonFile(fileName, optional: false);
return builder.Build();
}
return null;
}
}
}

13
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/DemoAppModule.cs

@ -1,10 +1,8 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs.DemoApp.Shared;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Modularity;
@ -21,15 +19,6 @@ namespace Volo.Abp.BackgroundJobs.DemoApp
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = ConfigurationHelper.BuildConfiguration();
context.Services.SetConfiguration(configuration);
Configure<DbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = configuration.GetConnectionString("Default");
});
Configure<AbpDbContextOptions>(options =>
{
options.Configure(opts =>

6
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj

@ -14,4 +14,10 @@
<ProjectReference Include="..\Volo.Abp.BackgroundJobs.DemoApp.Shared\Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Loading…
Cancel
Save