Skip to content

Commit 248aebd

Browse files
authored
Merge pull request #63 from dotnetcore/dev
Make IEasyCaching Obsolete.
2 parents 0c872ee + a195717 commit 248aebd

File tree

17 files changed

+254
-209
lines changed

17 files changed

+254
-209
lines changed

build/releasenotes.props

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
<Project>
22
<PropertyGroup>
33
<EasyCachingCorePackageNotes>
4-
1. Support Named Provider
4+
1. Make IEasyCaching Obsolete.
5+
2. Remove the class restrict
56
</EasyCachingCorePackageNotes>
67
<EasyCachingMemcachedPackageNotes>
7-
1. Support Named Provider
8-
2. Upgrade EnyimMemcachedCore to 2.1.10
8+
1. Remove the class restrict
99
</EasyCachingMemcachedPackageNotes>
1010
<EasyCachingRedisPackageNotes>
11-
1. Support Named Provider
12-
2. Upgrade StackExchange.Redis to 2.0.519
11+
1. Remove the class restrict
1312
</EasyCachingRedisPackageNotes>
1413
<EasyCachingSQLitePackageNotes>
15-
1. Support Named Provider
14+
1. Remove the class restrict
1615
</EasyCachingSQLitePackageNotes>
1716
<EasyCachingInMemoryPackageNotes>
18-
1. Support Named Provider
17+
1. Remove the class restrict
1918
</EasyCachingInMemoryPackageNotes>
2019
<EasyCachingHybridPackageNotes>
21-
1. Support .NET Core 2.1
20+
1. Remove the class restrict
2221
</EasyCachingHybridPackageNotes>
2322
<EasyCachingAspectCorePackageNotes>
24-
1. Fixed bug of intercepting Task methods.
23+
1. Remove Dependency of IEasyCaching.
2524
</EasyCachingAspectCorePackageNotes>
2625
<EasyCachingCastlePackageNotes>
27-
1. Support .NET Core 2.1
26+
1. Remove Dependency of IEasyCaching.
2827
</EasyCachingCastlePackageNotes>
2928
<EasyCachingResponseCachingPackageNotes>
3029
1. Support .NET Core 2.1

build/version.props

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project>
22
<PropertyGroup>
3-
<EasyCachingCorePackageVersion>0.4.0</EasyCachingCorePackageVersion>
4-
<EasyCachingMemcachedPackageVersion>0.4.0</EasyCachingMemcachedPackageVersion>
5-
<EasyCachingRedisPackageVersion>0.4.0</EasyCachingRedisPackageVersion>
6-
<EasyCachingSQLitePackageVersion>0.4.0</EasyCachingSQLitePackageVersion>
7-
<EasyCachingInMemoryPackageVersion>0.4.0</EasyCachingInMemoryPackageVersion>
3+
<EasyCachingCorePackageVersion>0.4.1</EasyCachingCorePackageVersion>
4+
<EasyCachingMemcachedPackageVersion>0.4.1</EasyCachingMemcachedPackageVersion>
5+
<EasyCachingRedisPackageVersion>0.4.1</EasyCachingRedisPackageVersion>
6+
<EasyCachingSQLitePackageVersion>0.4.1</EasyCachingSQLitePackageVersion>
7+
<EasyCachingInMemoryPackageVersion>0.4.1</EasyCachingInMemoryPackageVersion>
88
<EasyCachingHybridPackageVersion>0.3.0</EasyCachingHybridPackageVersion>
9-
<EasyCachingAspectCorePackageVersion>0.3.1</EasyCachingAspectCorePackageVersion>
10-
<EasyCachingCastlePackageVersion>0.3.0</EasyCachingCastlePackageVersion>
9+
<EasyCachingAspectCorePackageVersion>0.3.2</EasyCachingAspectCorePackageVersion>
10+
<EasyCachingCastlePackageVersion>0.3.2</EasyCachingCastlePackageVersion>
1111
<EasyCachingResponseCachingPackageVersion>0.3.0</EasyCachingResponseCachingPackageVersion>
1212
<EasyCachingJsonPackageVersion>0.3.1</EasyCachingJsonPackageVersion>
1313
<EasyCachingMessagePackPackageVersion>0.3.0</EasyCachingMessagePackPackageVersion>

sample/EasyCaching.Demo.Interceptors/Services/IAspectCoreService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using EasyCaching.Core.Internal;
44
using System.Threading.Tasks;
55

6-
public interface IAspectCoreService : EasyCaching.Core.Internal.IEasyCaching
6+
public interface IAspectCoreService //: EasyCaching.Core.Internal.IEasyCaching
77
{
88
[EasyCachingAble(Expiration = 10)]
99
string GetCurrentUtcTime();

sample/EasyCaching.Demo.Interceptors/Services/ICastleService.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,52 @@
55

66
public interface ICastleService
77
{
8+
[EasyCachingAble(Expiration = 10)]
89
string GetCurrentUtcTime();
910

11+
[EasyCachingPut(CacheKeyPrefix = "Castle")]
1012
string PutSomething(string str);
1113

14+
[EasyCachingEvict(IsBefore = true)]
1215
void DeleteSomething(int id);
1316

17+
[EasyCachingAble(Expiration = 10)]
1418
Task<string> GetUtcTimeAsync();
1519

20+
[EasyCachingAble(Expiration = 10)]
1621
Task<Demo> GetDemoAsync(int id);
1722

23+
[EasyCachingAble(Expiration = 10)]
1824
Demo GetDemo(int id);
1925
}
2026

21-
public class CastleService : ICastleService, IEasyCaching
27+
public class CastleService : ICastleService//, IEasyCaching
2228
{
23-
[EasyCachingEvict(IsBefore = true)]
2429
public void DeleteSomething(int id)
2530
{
2631
System.Console.WriteLine("Handle delete something..");
2732
}
2833

29-
[EasyCachingAble(Expiration = 10)]
3034
public string GetCurrentUtcTime()
3135
{
3236
return System.DateTime.UtcNow.ToString();
3337
}
3438

35-
[EasyCachingAble(Expiration = 10)]
3639
public Demo GetDemo(int id)
3740
{
3841
return new Demo { Id = id, CreateTime = System.DateTime.Now, Name = "catcher" };
3942
}
4043

41-
[EasyCachingAble(Expiration = 10)]
4244
public Task<Demo> GetDemoAsync(int id)
4345
{
4446
return Task.FromResult(new Demo { Id = id, CreateTime = System.DateTime.Now, Name = "catcher" });
4547
}
4648

47-
[EasyCachingAble(Expiration = 10)]
4849
public async Task<string> GetUtcTimeAsync()
4950
{
5051
return await Task.FromResult<string>(System.DateTimeOffset.UtcNow.ToString());
5152
}
5253

53-
[EasyCachingPut(CacheKeyPrefix = "Castle")]
5454
public string PutSomething(string str)
5555
{
5656
return str;

sample/EasyCaching.Demo.Interceptors/Startup.cs

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,81 +22,81 @@ public Startup(IConfiguration configuration)
2222

2323
public IConfiguration Configuration { get; }
2424

25-
//1.AspectCore
26-
public IServiceProvider ConfigureServices(IServiceCollection services)
27-
{
28-
services.AddScoped<IAspectCoreService, AspectCoreService>();
25+
////1.AspectCore
26+
//public IServiceProvider ConfigureServices(IServiceCollection services)
27+
//{
28+
// services.AddScoped<IAspectCoreService, AspectCoreService>();
2929

30-
//services.AddDefaultInMemoryCache();
31-
services.AddDefaultRedisCache(options =>
32-
{
33-
options.DBConfig = new RedisDBOptions { Configuration = "localhost" };
34-
});
30+
// services.AddDefaultInMemoryCache();
31+
// //services.AddDefaultRedisCache(options =>
32+
// //{
33+
// // options.DBConfig = new RedisDBOptions { Configuration = "localhost" };
34+
// //});
3535

36-
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
36+
// services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
3737

38-
//1.1. all default
39-
return services.ConfigureAspectCoreInterceptor();
38+
// //1.1. all default
39+
// return services.ConfigureAspectCoreInterceptor();
4040

41-
//1.2. default and customize
42-
//Action<IServiceContainer> action = x =>
43-
//{
44-
// x.AddType<IAspectCoreService, AspectCoreService>();
45-
//};
41+
// //1.2. default and customize
42+
// //Action<IServiceContainer> action = x =>
43+
// //{
44+
// // x.AddType<IAspectCoreService, AspectCoreService>();
45+
// //};
4646

47-
//return services.ConfigureAspectCoreInterceptor(action);
47+
// //return services.ConfigureAspectCoreInterceptor(action);
4848

49-
//1.3. all customize
50-
//Action<IServiceContainer> action = x =>
51-
//{
52-
// x.AddType<IDateTimeService, DateTimeService>();
53-
// x.Configure(config =>
54-
// {
55-
// config.Interceptors.AddTyped<EasyCachingInterceptor>(method => typeof(Core.Internal.IEasyCaching).IsAssignableFrom(method.DeclaringType));
56-
// });
57-
//};
49+
// //1.3. all customize
50+
// //Action<IServiceContainer> action = x =>
51+
// //{
52+
// // x.AddType<IDateTimeService, DateTimeService>();
53+
// // x.Configure(config =>
54+
// // {
55+
// // config.Interceptors.AddTyped<EasyCachingInterceptor>(method => typeof(Core.Internal.IEasyCaching).IsAssignableFrom(method.DeclaringType));
56+
// // });
57+
// //};
5858

59-
//return services.ConfigureAspectCoreInterceptor(action, true);
60-
}
59+
// //return services.ConfigureAspectCoreInterceptor(action, true);
60+
//}
6161

62-
////2. Castle
63-
//public IServiceProvider ConfigureServices(IServiceCollection services)
64-
//{
65-
// services.AddMvc();
62+
//2. Castle
63+
public IServiceProvider ConfigureServices(IServiceCollection services)
64+
{
65+
services.AddMvc();
6666

67-
// services.AddTransient<ICastleService, CastleService>();
67+
services.AddTransient<ICastleService, CastleService>();
6868

69-
// services.AddDefaultInMemoryCache();
69+
services.AddDefaultInMemoryCache();
7070

71-
// //2.1. all default
72-
// return services.ConfigureCastleInterceptor();
71+
//2.1. all default
72+
return services.ConfigureCastleInterceptor();
7373

74-
// //2.2. default and customize
75-
// //Action<ContainerBuilder> action = x =>
76-
// //{
77-
// // x.RegisterType<CastleService>().As<ICastleService>();
78-
// //};
74+
//2.2. default and customize
75+
//Action<ContainerBuilder> action = x =>
76+
//{
77+
// x.RegisterType<CastleService>().As<ICastleService>();
78+
//};
7979

80-
// //return services.ConfigureCastleInterceptor(action);
80+
//return services.ConfigureCastleInterceptor(action);
8181

82-
// //2.3. all customize
83-
// //Action<ContainerBuilder> action = x =>
84-
// //{
85-
// // x.RegisterType<DateTimeService>().As<IDateTimeService>();
82+
//2.3. all customize
83+
//Action<ContainerBuilder> action = x =>
84+
//{
85+
// x.RegisterType<DateTimeService>().As<IDateTimeService>();
8686

87-
// // var assembly = Assembly.GetExecutingAssembly();
88-
// // x.RegisterType<EasyCachingInterceptor>();
87+
// var assembly = Assembly.GetExecutingAssembly();
88+
// x.RegisterType<EasyCachingInterceptor>();
8989

90-
// // x.RegisterAssemblyTypes(assembly)
91-
// // .Where(type => typeof(Core.Internal.IEasyCaching).IsAssignableFrom(type) && !type.GetTypeInfo().IsAbstract)
92-
// // .AsImplementedInterfaces()
93-
// // .InstancePerLifetimeScope()
94-
// // .EnableInterfaceInterceptors()
95-
// // .InterceptedBy(typeof(EasyCachingInterceptor));
96-
// //};
90+
// x.RegisterAssemblyTypes(assembly)
91+
// .Where(type => typeof(Core.Internal.IEasyCaching).IsAssignableFrom(type) && !type.GetTypeInfo().IsAbstract)
92+
// .AsImplementedInterfaces()
93+
// .InstancePerLifetimeScope()
94+
// .EnableInterfaceInterceptors()
95+
// .InterceptedBy(typeof(EasyCachingInterceptor));
96+
//};
9797

98-
// //return services.ConfigureCastleInterceptor(action, true);
99-
//}
98+
//return services.ConfigureCastleInterceptor(action, true);
99+
}
100100

101101
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
102102
{

0 commit comments

Comments
 (0)