Skip to content

Commit cf81962

Browse files
author
Musa Demir
committed
1 parent d46dd7a commit cf81962

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

src/AbpCompanyName.AbpProjectName.WebMpa/AbpCompanyName.AbpProjectName.WebMpa.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,6 +2768,7 @@
27682768
<Content Include="Views\Home\Index.cshtml" />
27692769
</ItemGroup>
27702770
<ItemGroup>
2771+
<Compile Include="AbpZeroTemplateClientInfoProvider.cs" />
27712772
<Compile Include="App_Start\BundleConfig.cs" />
27722773
<Compile Include="App_Start\AbpProjectNameNavigationProvider.cs" />
27732774
<Compile Include="App_Start\AbpProjectNameWebModule.cs" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Web;
2+
using Abp.Auditing;
3+
4+
namespace AbpCompanyName.AbpProjectName.WebMpa
5+
{
6+
//TODO:Remove temporary solution of https://github.com/aspnetboilerplate/aspnetboilerplate/pull/5308.
7+
public class AbpZeroTemplateClientInfoProvider : WebClientInfoProvider, IClientInfoProvider
8+
{
9+
public override HttpContextBase GetCurrentHttpContext()
10+
{
11+
return HttpContext.Current == null ? null : new HttpContextWrapper(HttpContext.Current);
12+
}
13+
}
14+
}

src/AbpCompanyName.AbpProjectName.WebMpa/App_Start/AbpProjectNameWebModule.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
using System.Web.Mvc;
44
using System.Web.Optimization;
55
using System.Web.Routing;
6+
using Abp.Auditing;
7+
using Abp.Dependency;
68
using Abp.Hangfire;
79
using Abp.Hangfire.Configuration;
810
using Abp.Zero.Configuration;
911
using Abp.Modules;
1012
using Abp.Web.Mvc;
1113
using Abp.Web.SignalR;
1214
using AbpCompanyName.AbpProjectName.Api;
15+
using Castle.Core;
1316
using Castle.MicroKernel.Registration;
1417
using Hangfire;
1518
using Microsoft.Owin.Security;
@@ -38,6 +41,11 @@ public override void PreInitialize()
3841
//{
3942
// configuration.GlobalConfiguration.UseSqlServerStorage("Default");
4043
//});
44+
45+
Configuration.ReplaceService(typeof(IClientInfoProvider), () =>
46+
{
47+
Configuration.IocManager.Register<IClientInfoProvider, AbpZeroTemplateClientInfoProvider>(DependencyLifeStyle.Transient);
48+
});
4149
}
4250

4351
public override void Initialize()

src/AbpCompanyName.AbpProjectName.WebSpaAngular/AbpCompanyName.AbpProjectName.WebSpaAngular.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3579,6 +3579,7 @@
35793579
<Content Include="Views\_ViewStart.cshtml" />
35803580
</ItemGroup>
35813581
<ItemGroup>
3582+
<Compile Include="AbpZeroTemplateClientInfoProvider.cs" />
35823583
<Compile Include="App_Start\BundleConfig.cs" />
35833584
<Compile Include="App_Start\AbpProjectNameNavigationProvider.cs" />
35843585
<Compile Include="App_Start\AbpProjectNameWebModule.cs" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Web;
2+
using Abp.Auditing;
3+
4+
namespace AbpCompanyName.AbpProjectName.WebMpa
5+
{
6+
//TODO:Remove temporary solution of https://github.com/aspnetboilerplate/aspnetboilerplate/pull/5308.
7+
public class AbpZeroTemplateClientInfoProvider : WebClientInfoProvider, IClientInfoProvider
8+
{
9+
public override HttpContextBase GetCurrentHttpContext()
10+
{
11+
return HttpContext.Current == null ? null : new HttpContextWrapper(HttpContext.Current);
12+
}
13+
}
14+
}

src/AbpCompanyName.AbpProjectName.WebSpaAngular/App_Start/AbpProjectNameWebModule.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
using System.Web.Mvc;
33
using System.Web.Optimization;
44
using System.Web.Routing;
5+
using Abp.Auditing;
6+
using Abp.Dependency;
57
using Abp.Hangfire;
68
using Abp.Hangfire.Configuration;
79
using Abp.Modules;
810
using Abp.Web.Mvc;
911
using Abp.Web.SignalR;
1012
using Abp.Zero.Configuration;
1113
using AbpCompanyName.AbpProjectName.Api;
14+
using AbpCompanyName.AbpProjectName.WebMpa;
1215
using Hangfire;
1316

1417
namespace AbpCompanyName.AbpProjectName.WebSpaAngular
@@ -35,6 +38,11 @@ public override void PreInitialize()
3538
//{
3639
// configuration.GlobalConfiguration.UseSqlServerStorage("Default");
3740
//});
41+
42+
Configuration.ReplaceService(typeof(IClientInfoProvider), () =>
43+
{
44+
Configuration.IocManager.Register<IClientInfoProvider, AbpZeroTemplateClientInfoProvider>(DependencyLifeStyle.Transient);
45+
});
3846
}
3947

4048
public override void Initialize()

0 commit comments

Comments
 (0)