0
我一直在阅读这篇文章,以帮助我开始缓存并遇到问题。当我尝试做一个调用下面的方法我收到以下错误:在使用Spring.NET缓存时遇到问题
"Cannot initialize property or field node 'LocalTariffId' because the specified context is null."
我以为属性语法我使用下面,一旦它返回到缓存我的数据会使用结果的LocalTariffId财产。当我尝试进入该方法时,会发生此错误。在我看来,它试图尽快访问该属性。我必须错过一些东西,所以你可以提供的任何建议非常感谢!
[CacheResult("AspNetCache", "'LocalTariff.Id=' + LocalTariffId", TimeToLive = "00:10:00")]
public Domain.LocalTariffs.LocalTariff GetDefault(string agencyCode)
我在第一个错误之后出现了一个奇怪的错误,我希望有人能够澄清一些事情。至少我认为它与log4net有关。我的日志记录工作,所以我不知道这是什么。
IGCSoftware.HHG.Business.LocalTariffsFacade - Exception thrown in GetDefaultLocalTariff;GetDefaultLocalTariff;9c0bb393-369c-4501-a2ce-9325fe525e38;183341 ms
<log4net.Error>Exception rendering object type [Spring.Core.NullValueInNestedPathException]<stackTrace>System.BadImageFormatException: The parameters and the signature of the method don't match.
at System.Reflection.RuntimeParameterInfo.GetParameters(IRuntimeMethodInfo methodHandle, MemberInfo member, Signature sig, ParameterInfo& returnParameter, Boolean fetchReturnParameter)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParameters()
at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat)
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Exception.GetStackTrace(Boolean needFileInfo)
at System.Exception.ToString(Boolean needFileLineInfo)
at System.Exception.ToString()
at log4net.ObjectRenderer.DefaultRenderer.RenderObject(RendererMap rendererMap, Object obj, TextWriter writer)
at log4net.ObjectRenderer.RendererMap.FindAndRender(Object obj, TextWriter writer)</stackTrace></log4net.Error>
布鲁诺,关于这篇文章http://forum.springframework.net/showpost.php?p=10767&postcount=2在你的文章的底部我以为你引用了一个返回对象的属性([CacheResultItems( “thingById”,“Id”)] //将使用Thing.Id作为键)。你能为我澄清一点吗? – avidgoffer 2010-07-01 13:59:31