例如我有IRepository
,由Repository
和一些拦截器实现。
在拦截器内部,我看到IRepositoryProxy
basetype是Object
而不是Repository
。
例如:我解析IRepository
并致电GetFunctionalityPurposes
,
我想要的是调用GetAllFunctionalityPurposes
也被缓存/代理。
这不起作用,因为方法是在Repository
而不是IRepositoryProxy
中调用的。
IRepository
FunctionalityPurpose[] GetFunctionalityPurposes();
FunctionalityPurpose[] GetAllFunctionalityPurposes()
存储库
[Cached("Tender")]
public virtual FunctionalityPurpose[] GetFunctionalityPurposes()
{
var model = GetAllFunctionalityPurposes()
.Where(r => !r.IsHidden && !r.GroupId.HasValue);
return model;
}
[Cached("Tender", "FunctionalityPurpose")]
public virtual FunctionalityPurpose[] GetAllFunctionalityPurposes()
{
var model = UnitOfWork.GetSet<Model>().Select(f => f.FunctionalityPurpose)
.Distinct().OrderBy(r => r.Id).ToArray();
return model;
}
答案 0 :(得分:0)
我调查了https://github.com/castleproject/Windsor/blob/master/src/Castle.Windsor/Windsor/Proxy/DefaultProxyFactory.cs#L110,我已经轻松完成了注册:Dim strCache() As String = Split(fileReader.ReadLine(), ";")
Dim repStrX = strCache(intValXAxis - 1).Replace(",","G").Replace(".",",").Replace("G",".")
Dim repStrY = strCache(intValYAxis - 1).Replace(",","G").Replace(".",",").Replace("G",".")
ChartSeries(i).Points.AddXY(repStrX , repStrY)
注意。通过ServiceSelf()调用,这实际上会切换基于类的代理