Skip to content

Commit afc1e6d

Browse files
committed
how to instantiace logger factory
1 parent 8fd17e9 commit afc1e6d

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

SharpRepository.Caching.Memcached/MemCachedConfigCachingProviderFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public override ICachingProvider GetInstance()
2525
#if NET451
2626
return new MemcachedCachingProvider(ClientConfiguration);
2727
#elif NETSTANDARD2_0
28-
return new MemcachedCachingProvider(LoggerFactory, ClientConfiguration);
28+
return new MemcachedCachingProvider(LoggerFactory ?? new Microsoft.Extensions.Logging.LoggerFactory(), ClientConfiguration);
2929
#endif
3030
}
3131
}

SharpRepository.Caching.Memcached/SharpRepository.Caching.Memcached.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</ItemGroup>
2525
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
2626
<PackageReference Include="EnyimMemcachedCore" Version="2.1.0.6" />
27+
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
2728
</ItemGroup>
2829
<ItemGroup Condition="'$(TargetFramework)' == 'net451'">
2930
<PackageReference Include="EnyimMemcached" Version="2.16.0" />

SharpRepository.Samples.CoreMvc/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System;
1010
using MongoDB.Bson.Serialization;
1111
using SharpRepository.CoreMvc.Models;
12+
using Microsoft.Extensions.Logging;
1213

1314
namespace SharpRepository.CoreMvc
1415
{
@@ -40,6 +41,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
4041
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
4142
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
4243
{
44+
4345
if (env.IsDevelopment())
4446
{
4547
app.UseDeveloperExceptionPage();

SharpRepository.Samples.CoreMvc/appsettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"efCore": {
3131
"factory": "SharpRepository.EfCoreRepository.EfCoreConfigRepositoryFactory, SharpRepository.EfCoreRepository",
3232
"dbContextType": "SharpRepository.CoreMvc.ContactContext, SharpRepository.Samples.CoreMvc",
33-
"cachingStrategy": "none",
34-
"cachingProvider": "noCachingProvider"
33+
"cachingStrategy": "standard",
34+
"cachingProvider": "memCachedProvider"
3535
}
3636
},
3737
"cachingProviders": {

0 commit comments

Comments
 (0)