c# 3.0 - System.InvalidOperationException error MVC3 ASP.net -


can me in error im searching on how solve problem can make clear if post error , codes here

> server error in '/' application. entity type applicant not part of model current context. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.  exception details: system.invalidoperationexception: entity type applicant not part of model current context.  source error:   line 19:         public ienumerable<applicant> getapplicant() line 20:         { line 21:             return context.applicants.tolist(); line 22:         } line 23:     stack trace:   [invalidoperationexception: entity type applicant not part of model current context.]    system.data.entity.internal.internalcontext.updateentitysetmappingsfortype(type entitytype) +209    system.data.entity.internal.internalcontext.getentitysetandbasetypefortype(type entitytype) +51    system.data.entity.internal.linq.internalset`1.initialize() +164    system.data.entity.internal.linq.internalset`1.getenumerator() +38    system.data.entity.infrastructure.dbquery`1.system.collections.generic.ienumerable<tresult>.getenumerator() +99    system.collections.generic.list`1..ctor(ienumerable`1 collection) +369    system.linq.enumerable.tolist(ienumerable`1 source) +58    _2ndapplicants.dal.applicantrepository.getapplicant() in c:\users\documents\visual studio 2010\2ndapplicant\2ndapplicant\dal\applicantrepository.cs:21    _2ndapplicant.controllers.applicantcontroller.index(string currentfilter, string searchstring, nullable`1 page) in c:\users\documents\visual studio 2010\2ndapplicant\2ndapplicant\controllers\applicantcontroller.cs:49    lambda_method(closure , controllerbase , object[] ) +295    system.web.mvc.actionmethoddispatcher.execute(controllerbase controller, object[] parameters) +14    system.web.mvc.reflectedactiondescriptor.execute(controllercontext controllercontext, idictionary`2 parameters) +214    system.web.mvc.controlleractioninvoker.invokeactionmethod(controllercontext controllercontext, actiondescriptor actiondescriptor, idictionary`2 parameters) +27    system.web.mvc.<>c__displayclass15.<invokeactionmethodwithfilters>b__12() +55    system.web.mvc.controlleractioninvoker.invokeactionmethodfilter(iactionfilter filter, actionexecutingcontext precontext, func`1 continuation) +253    system.web.mvc.<>c__displayclass17.<invokeactionmethodwithfilters>b__14() +21    system.web.mvc.controlleractioninvoker.invokeactionmethodwithfilters(controllercontext controllercontext, ilist`1 filters, actiondescriptor actiondescriptor, idictionary`2 parameters) +191    system.web.mvc.controlleractioninvoker.invokeaction(controllercontext controllercontext, string actionname) +324    system.web.mvc.controller.executecore() +106    system.web.mvc.controllerbase.execute(requestcontext requestcontext) +91    system.web.mvc.controllerbase.system.web.mvc.icontroller.execute(requestcontext requestcontext) +10    system.web.mvc.<>c__displayclassb.<beginprocessrequest>b__5() +34    system.web.mvc.async.<>c__displayclass1.<makevoiddelegate>b__0() +19    system.web.mvc.async.<>c__displayclass8`1.<beginsynchronous>b__7(iasyncresult _) +10    system.web.mvc.async.wrappedasyncresult`1.end() +62    system.web.mvc.<>c__displayclasse.<endprocessrequest>b__d() +48    system.web.mvc.securityutil.<getcallinapptrustthunk>b__0(action f) +7    system.web.mvc.securityutil.processinapplicationtrust(action action) +22    system.web.mvc.mvchandler.endprocessrequest(iasyncresult asyncresult) +60    system.web.mvc.mvchandler.system.web.ihttpasynchandler.endprocessrequest(iasyncresult result) +9    system.web.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +9629296    system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +155   version information: microsoft .net framework version:4.0.30319; asp.net version:4.0.30319.18034  

in line

public class applicantrepository : iapplicantrepository, idi 

sposable { private entities context;

    public applicantrepository(entities context)     {         this.context = context;     }      public ienumerable<applicant> getapplicant()     {         return context.applicants.tolist(); <--------- triggered error     }      public applicant getapplicantbyid(int id)     {         return context.applicants.find(id);     } 

im search on how can solve can appreciated :) :3


Comments