Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

Could not map property ProjectId - table tblBigTable does not contain any columns that map to DbType.Int32

Vote:
 

We are upgrading a v11 CMS to v12. When running the v12 solution, the following error is logged every time the solution is run.

Could not map property ProjectId - table tblBigTable does not contain any columns that map to DbType.Int32

My understanding is that ProjectId is supposed to be stored in the DDS, but it's not configured correctly.

The only other hits I find online about this issue refer to not upgrading the database correctly and scripts not running, however, that's not an issue with v11 -> v12 upgrades since we don't have to upgrade the database manually. 

I also wonder if there's a missing entry in the tblBigTableStoreInfo table for "ProjectId". That would explain the error trying to map to Int32 since that table has PropertyName (eg "ProjectId") and PropertyType (eg "System.Int32") as well as ColumnName (eg "Integer01"). It looks like a table that would map properties to types.

I'm very interested in finding a solution for this because it seems ProjectId isn't being stored in the DDS as expected.

===> 09:36:02 [Error] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Could not map property ProjectId - table tblBigTable does not contain any columns that map to DbType.Int32
   at EPiServer.Data.Dynamic.Providers.ColumnInformationMapper.Map(KeyValuePair`2 property, Type dataType, StoreDefinitionParameters parameters, List`1 rows)
   at EPiServer.Data.Dynamic.InlinePropertyMapHandler.TryMap(KeyValuePair`2 property, PropertyMapHandlerContext context, PropertyMap& propertyMap)
   at EPiServer.Data.Dynamic.StoreDefinition.GenerateMappings(IEnumerable`1 typeBag, StoreDefinitionParameters parameters, Int32 version, IList`1 existingMappings, IDictionary`2 pendingRenames)
   at EPiServer.Data.Dynamic.StoreDefinition.<>c__DisplayClass28_0.<InternalCreate>b__0()
   at EPiServer.Data.Cache.Internal.LocalCache`2.Add(TKey key, Boolean cacheNullValues, Boolean overwriteExistingValue, Func`1 getAction, Action`2 setAction)
   at EPiServer.Data.Dynamic.StoreDefinition.InternalCreate(String storeName, IDictionary`2 typeBag, StoreDefinitionParameters parameters)
   at EPiServer.Data.Dynamic.Internal.EPiServerDynamicDataStoreFactory.CreateStore(String storeName, IDictionary`2 typeBag, StoreDefinitionParameters parameters)
   at EPiServer.Data.Dynamic.Internal.EPiServerDynamicDataStoreFactory.<>c__DisplayClass14_0.<GetStore>b__0()
   at EPiServer.Data.Cache.Internal.LocalCache`2.Add(TKey key, Boolean cacheNullValues, Boolean overwriteExistingValue, Func`1 getAction, Action`2 setAction)
   at EPiServer.Data.Dynamic.Internal.EPiServerDynamicDataStoreFactory.GetStore(Type type)
   at EPiServer.Cms.Shell.UI.Rest.Projects.Internal.DdsProjectEnhancementsStore.GetStore()
   at EPiServer.Cms.Shell.UI.Rest.Projects.Internal.DdsProjectEnhancementsStore.LoadProjectSettings(Int32 projectId)
   at EPiServer.Cms.Shell.UI.Rest.Projects.Internal.Models.ProjectConverter.GetViewModel(Project model)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at EPiServer.Shell.Services.Rest.ItemRange.ApplyTo[T](IEnumerable`1 items)
   at EPiServer.Shell.Services.Rest.RestControllerBase.Rest(IEnumerable`1 data, ItemRange range)
   at EPiServer.Cms.Shell.UI.Rest.Projects.Internal.ProjectStore.Get(Nullable`1 id, ItemRange range, IEnumerable`1 sortColumns)
   at lambda_method461(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Geta.NotFoundHandler.Infrastructure.Initialization.NotFoundHandlerMiddleware.InvokeAsync(HttpContext context, RequestHandler requestHandler)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
#324608
Edited, Jun 27, 2024 17:15
Vote:
 

An update, but still not a fix:

I was able to decompile the code to figure out what is throwing that error and traced the problem back to this line in EPiServer.Data.Dynamic.Providers.ColumnInformationMapper.Map().

columnInformation = rows[index].GetColumn(dataType, requireIndexed, true);

It's trying to find a datatype that is "Int32" and also is required to be indexed. I don't think it's finding the right mapping because it's not finding any indexable Int32 property types.

The reason it's passing requireIndexed as true is the line just before the one above.

bool requireIndexed = parameters.IndexNames.Contains(key);

parameters in this case is the tblBigTable and the IndexNames property contains only one key: "ProjectId".

I can't find where tblBigTable has stored any information that populates IndexNames with ProjectId, though. I think my next step is to continue to decompile code to find how that property is populated. Perhaps I can find a SQL statement that shows something useful. 

I even set up appsettings.json with this entry to auto-remap the DDS, but it didn't fix the issue.

"EPiServer": {
  "Cms": {
    "DynamicDataStore": {
      "AutoResolveTypes": true,
      "AutoRemapStores": true
    }
  }
}
#326713
Edited, Aug 08, 2024 3:29
Vote:
 

I figured it out. The tblBigTable was missing indexes.

From another CMS 12 database:

I bet this happened during one of the version updates before I was brought onto the project. A lot of similar posts from before 2018 said this happens when the scripts are run during the upgrade process, so that's probably what happened here.

My solution was to use SSMS to build a CREATE INDEX scripts based on the other CMS 12 database and I run them in the other database. Once the indexes were created, the error went away. Also, the CMS is a lot more responsive now. We used to have issues with the Content Tree not loading until you refreshed the page, but I haven't seen that since I made this fix. Hopefully, it was related.

#326716
Aug 08, 2024 4:14
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.