Created
January 6, 2018 23:49
-
-
Save aramkoukia/ad93d9d4307dbb081609f0858c0594a9 to your computer and use it in GitHub Desktop.
Cache Attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Unity; | |
using Unity.Interception.PolicyInjection.Pipeline; | |
using Unity.Interception.PolicyInjection.Policies; | |
namespace CachingAspectOrientedImplemetation | |
{ | |
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] | |
public class CacheAttribute : HandlerAttribute | |
{ | |
public string KeyPrefix { get; set; } | |
public CacheAttribute(string keyPrefix) | |
{ | |
KeyPrefix = keyPrefix; | |
} | |
public override ICallHandler CreateHandler(IUnityContainer container) | |
{ | |
return new CacheAttributeHandler(this.KeyPrefix); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment