У меня проблемы с переходом с MVC 1 на MVC 2.
В моем старом проекте я использовал Active Record.
Сейчас выполняется новый проект, в котором пытаются получить данные из репозитория
public T[] SlicedFindAll(int firstResult, int maxResult, DetachedCriteria criteria)
{
return ActiveRecordMediator<T>.SlicedFindAll(firstResult, maxResult, criteria);
}
Я получаю сообщение об ошибке «Указанный ключ отсутствует в словаре».
Это трассировка стека:
[KeyNotFoundException: указанный ключ отсутствует в словаре.]
System.Collections.Generic.Dictionary 2.get_Item(TKey key) +9627953
NHibernate.Cfg.Mapping.GetPersistentClass(String className) +85
NHibernate.Cfg.Mapping.GetIdentifierType(String className) +66
NHibernate.Type.EntityType.GetIdentifierType(IMapping factory) +84
NHibernate.Type.EntityType.GetIdentifierOrUniqueKeyType(IMapping factory) +112
NHibernate.Type.ManyToOneType.GetColumnSpan(IMapping mapping) +66
NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping) +96
NHibernate.Mapping.ToOne.IsValid(IMapping mapping) +144
NHibernate.Mapping.Property.IsValid(IMapping mapping) +80
NHibernate.Mapping.PersistentClass.Validate(IMapping mapping) +138
NHibernate.Mapping.RootClass.Validate(IMapping mapping) +68
NHibernate.Cfg.Configuration.ValidateEntities() +246
NHibernate.Cfg.Configuration.Validate() +44
NHibernate.Cfg.Configuration.BuildSessionFactory() +86
Castle.ActiveRecord.Framework.SessionFactoryHolder.GetSessionFactory(Type type) in d:\Dev\Out\castleproject-Castle.ActiveRecord-b0f7972\castleproject-Castle.ActiveRecord-b0f7972\src\Castle.ActiveRecord\Framework\SessionFactoryHolder.cs:135
Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateScopeSession(Type type) in d:\Dev\Out\castleproject-Castle.ActiveRecord-b0f7972\castleproject-Castle.ActiveRecord-b0f7972\src\Castle.ActiveRecord\Framework\SessionFactoryHolder.cs:296
Castle.ActiveRecord.Framework.SessionFactoryHolder.CreateSession(Type type) in d:\Dev\Out\castleproject-Castle.ActiveRecord-b0f7972\castleproject-Castle.ActiveRecord-b0f7972\src\Castle.ActiveRecord\Framework\SessionFactoryHolder.cs:182
Castle.ActiveRecord.ActiveRecordBase.SlicedFindAll(Type targetType, Int32 firstResult, Int32 maxResults, Order[] orders, DetachedCriteria criteria) in d:\Dev\Out\castleproject-Castle.ActiveRecord-b0f7972\castleproject-Castle.ActiveRecord-b0f7972\src\Castle.ActiveRecord\Framework\ActiveRecordBase.cs:1420
Castle.ActiveRecord.ActiveRecordMediator.SlicedFindAll(Type targetType, Int32 firstResult, Int32 maxResults, Order[] orders, DetachedCriteria criteria) in d:\Dev\Out\castleproject-Castle.ActiveRecord-b0f7972\castleproject-Castle.ActiveRecord-b0f7972\src\Castle.ActiveRecord\Framework\ActiveRecordMediator.cs:185
Castle.ActiveRecord.ActiveRecordMediator
1.SlicedFindAll (Int32 firstResult, Int32 maxResults, критерии DetachedCriteria, заказы Order []) в d: \ Dev \ Out \ castleproject-Castle.ActiveRecord-b0f7972 \ castleproject-Castle.ActiveRecord- b0f7972 \ SRC \ Castle.ActiveRecord \ Framework \ ActiveRecordMediator.Generic.cs: 241
Cameos.Core.Persistence.Repository 1.SlicedFindAll(Int32 firstResult, Int32 maxResult, DetachedCriteria criteria) in d:\Dev\MVC2\Cameos\src\Cameos.Core\Persistence\Repository.cs:96
Cameos.Core.Paging.PagedList
1..ctor (IRepository 1 repository, Int32 page, Int32 size, DetachedCriteria criteria) in d:\Dev\MVC2\Cameos\src\Cameos.Core\Paging\PagedList.cs:24
Cameos.Core.Paging.PagedList
1.Create (IRepository 1 repository, Int32 page, Int32 pageSize, DetachedCriteria criteria) in d:\Dev\MVC2\Cameos\src\Cameos.Core\Paging\PagedList.cs:13
Cameos.Core.Paging.PaginationHelpers.Paginate(IRepository
1, репозиторий Int32 startPage, Int32 pageSize, DetachedCriteria) в каталоге d: \ Dev \ MVC2 \ Cameos \ src \ Cameos.Core \ Paging \ PaginationHelpers.cs: 52
Cameos.Core.Paging.PaginationHelpers.Paginate (IRepository 1 repository, Int32 startPage, Int32 pageSize, Order order, ICriterion[] criteria) in d:\Dev\MVC2\Cameos\src\Cameos.Core\Paging\PaginationHelpers.cs:34
Cameos.Web.Areas.Admin.Controllers.CompanyController.Index(Nullable
1 страница) в папке d: \ Dev \ MVC2 \ Cameos \ src \ Cameos.Web2 \ Areas \ Admin \ Controllers \ CompanyController.cs: 26
lambda_method (Closure, ControllerBase, Object []) +145
System.Web.Mvc.ActionMethodDispatcher.Execute (контроллер ControllerBase, параметры Object []) +51
System.Web.Mvc.ReflectedActionDescriptor.Execute (ControllerContext controllerContext, IDictionary 2 parameters) +409
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 параметра) +52
System.Web.Mvc. <> C_ DisplayClassd.b _a () +127
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter (фильтр IActionFilter, предварительный контекст ActionExecutingContext, продолжение Func 1 continuation) +436
System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +61
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
1) +436
System.Web.Mvc. <> C_ DisplayClassf.b _c () +61
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters (ControllerContext controllerContext, параметры IList 1 filters, ActionDescriptor actionDescriptor, IDictionary
2) +305
System.Web.Mvc.ControllerActionInvoker.InvokeAction (ControllerContext controllerContext, String actionName) +830
System.Web.Mvc.Controller.ExecuteCore () +136
System.Web.Mvc.ControllerBase.Execute (RequestContext requestContext) +111
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute (RequestContext requestContext) +39
System.Web.Mvc. <> C_ DisplayClass8.b _4 () +65
System.Web.Mvc.Async. <> C_ DisplayClass1.b _0 () +44
System.Web.Mvc.Async. <> C__DisplayClass8 1.<BeginSynchronous>b__7(IAsyncResult _) +42
System.Web.Mvc.Async.WrappedAsyncResult
1.End () +141
System.Web.Mvc.Async.AsyncResultWrapper.End (IAsyncResult asyncResult, тег объекта) +54
System.Web.Mvc.Async.AsyncResultWrapper.End (IAsyncResult asyncResult, тег объекта) +40
System.Web.Mvc.MvcHandler.EndProcessRequest (IAsyncResult asyncResult) +52
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest (результат IAsyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () +8836913
System.Web.HttpApplication.ExecuteStep (шаг IExecutionStep, логическое и завершено синхронно) + 184