SORU
5 Aralık 2012, ÇARŞAMBA


Statik olmayan yöntem bir hedef gerektirir

Firefox ve yerel üretim hem de gayet iyi çalışıyor, ve yerel olarak YANİ o denetleyici bir eylem var, ama üretimde değil YANİ. İşte benim denetleyicisi eylem:

 public ActionResult MNPurchase()
        {
            CalculationViewModel calculationViewModel = (CalculationViewModel)TempData["calculationViewModel"];

            decimal OP = landTitleUnitOfWork.Sales.Find()
                                            .Where(x => x.Min >= calculationViewModel.SalesPrice)
                                            .FirstOrDefault()
                                            .OP;

            decimal MP = landTitleUnitOfWork.Sales.Find()
                                            .Where(x => x.Min >= calculationViewModel.MortgageAmount)
                                            .FirstOrDefault()
                                            .MP;

            calculationViewModel.LoanAmount = (OP   100) - MP;
            calculationViewModel.LendersTitleInsurance = (calculationViewModel.LoanAmount   850);


            return View(calculationViewModel);
        }

Yığın IE olsun izleme:

   Error.
    An error occurred while processing your request.
    System.Reflection.TargetException: Non-static method requires a target. at 
System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target) at 
System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags 
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at 
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder 
binder, Object[] parameters, CultureInfo culture) at 
System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at 
System.Data.Objects.ELinq.QueryParameterExpression.TryGetFieldOrPropertyValue(MemberExpression me, Object instance, Object& memberValue) at 
System.Data.Objects.ELinq.QueryParameterExpression.TryEvaluatePath(Expression expression, ConstantExpression& constantExpression) at 
System.Data.Objects.ELinq.QueryParameterExpression.EvaluateParameter(Object[] arguments) 
at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption) 
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at 
System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
 at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at 
System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source) at 
LandTitle.Controllers.HomeController.MNRefi() at lambda_method(Closure , ControllerBase ,
 Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext 
controllerContext, IDictionary`2 parameters) at 
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext 
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at 
Castle.Proxies.Invocations.ControllerActionInvoker_InvokeActionMethod.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at 
Glimpse.Mvc3.Interceptor.InvokeActionMethodInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at 
Castle.Proxies.AsyncControllerActionInvokerProxy.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at 
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() at 
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() at 
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) at 
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
    Home MNRefi

CEVAP
5 Aralık 2012, ÇARŞAMBA


Bu kafa karıştırıcı durum çalıştırma, boş bir referans olan bir lambda bir değişken kullandığınızda oluşur bence. Sizin durumunuzda, eğer değişken calculationViewModel boş bir referans olup olmadığını kontrol ediyorum.

Gibi bir şey

public ActionResult MNPurchase() {
    CalculationViewModel calculationViewModel = (CalculationViewModel)TempData["calculationViewModel"];

    if (calculationViewModel != null) {
        decimal OP = landTitleUnitOfWork.Sales.Find()
                                        .Where(x => x.Min >= calculationViewModel.SalesPrice)
                                        .FirstOrDefault()
                                        .OP;

        decimal MP = landTitleUnitOfWork.Sales.Find()
                                        .Where(x => x.Min >= calculationViewModel.MortgageAmount)
                                        .FirstOrDefault()
                                        .MP;

        calculationViewModel.LoanAmount = (OP   100) - MP;
        calculationViewModel.LendersTitleInsurance = (calculationViewModel.LoanAmount   850);


        return View(calculationViewModel);
    } else {
        // Do something else...
    }
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Justin Schenck

    Justin Schen

    24 Kasım 2006
  • kev5124

    kev5124

    9 Kasım 2008
  • TheDailyTechDose

    TheDailyTech

    15 EKİM 2012