Mur*_*buk 6 c# aop castle-windsor interceptor aspect
public class CachingInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
// code comes here....
}
}
Run Code Online (Sandbox Code Playgroud)
public class Business : IBusiness
{
public void Add(string a)
{
var t= GetAll();
// code comes here....
}
[CacheAttribute]
public string GetAll()
{
// code comes here....
}
}
Run Code Online (Sandbox Code Playgroud)
public class JustForTest
{
public JustForTest(IBusiness business)
{
//if GetAll is invoked directly caching works fine.
business.GetAll();
//if GetAll is invoked over Add method caching doesn't work.
business.Add();
}
}
Run Code Online (Sandbox Code Playgroud)
添加方法调用GetAll方法.如果我直接调用GetAll方法,缓存工作.如果Add方法调用GetAll方法,则缓存不起作用.
谢谢你的帮忙.
归档时间: |
|
查看次数: |
798 次 |
最近记录: |