Try our conversational search powered by Generative AI!

Upgraded 7.1 -> 7.5 - Type 'System.Decimal' could not be mapped to a PropertyDefinitionType

Vote:
 

I have upgraded our 7.1 site to 7.5. I think everything is in order, with nuget references, appdata, config etc.

I am getting the following error on startup. We do have a few decimal page properties, such as:

public virtual decimal RegularAmount { get; set; }

These were perviously working fine in 7.1. Has support for these been removed or does it look like I've missed a step in the upgrade?

 

Exception information:
Exception type: TargetInvocationException
Exception message: Exception has been thrown by the target of an invocation.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

Type 'System.Decimal' could not be mapped to a PropertyDefinitionType
at EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionSynchronizer.ResolveType(PropertyDefinitionModel model)
at EPiServer.DataAbstraction.RuntimeModel.PropertyDefinitionSynchronizer.CreatePropertyDefinition(PropertyDefinitionModel model, Int32 contentTypeID)
at EPiServer.DataAbstraction.RuntimeModel.ContentTypeModelRegister.CommitProperties(Boolean deleteUnusedTypes)
at EPiServer.DataAbstraction.RuntimeModel.ContentTypeModelScanner.Sync(Boolean commitChanges)
at EPiServer.Initialization.ModelSyncInitialization.Initialize(InitializationEngine context)
at EPiServer.Framework.Initialization.ModuleNode.<>c__DisplayClass5.<Initialize>b__4()
at EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key)
at EPiServer.Framework.Initialization.ModuleNode.Initialize(InitializationEngine context)
at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()
at EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType)
at EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType)
at EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType)
at EPiServer.Global..ctor()
at FitnessFirst.EpiServer.Web.Global..ctor()
at ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a2e429ac\e1c51da\App_global.asax.0.cs:line 0

 

Many thanks,

 

Matt

#79206
Dec 11, 2013 6:59
Vote:
 

Further update, when I change the properties to an int the site loads and behaves correctly.

Can you clarify whether decimal should be supported? It is not a blocker - we can easily switch to store currency in cents and switch to using int, but decimal is more correct semantically for our site.

Many thanks,

Matt.

#79207
Dec 11, 2013 7:14
Vote:
 

Hi Matt,

I just looked and we had an internal bug during development called "CMS says it supports both Decimal and Int64 but it does not". The problem was that the value was downconverted/upconverted in the database as a Double. Since this might lead to data loss the support for Decimal in CMS was removed. I will make sure that we update our breaking changes document to include this.

If you need to get back your values you should be able to change the type of your property to Double, since that's what it is stored as.

#79210
Dec 11, 2013 8:41
Vote:
 

So has this been addressed or is it just going to be left not supporting decimal?

#113499
Nov 21, 2014 21:39
Vote:
 

This has not been addressed yet but it is still in the backlog so it is something that we plan to support.

#113527
Nov 24, 2014 9:05
Vote:
 

+1 for adding support for decimal

#114501
Dec 12, 2014 19:17
Vote:
 

I'm assuming bigint (SQL server) which is mapped to Int.64 in ASP.NET C#, is not supported as well?

I'm getting a similar error, "Type 'System.Int64' could not be mapped to a PropertyDefinitionType".

Is this still not supported in EPiServer 8.0?

#119589
Mar 30, 2015 15:49
Vote:
 

Hi Nicola,

EPiServer 8 does not support Int64. There's a list of our supported backing types in the documentation:

http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/8/Content/Properties/property-attributes/#BackingTypes

/T

#119592
Mar 30, 2015 19:29
VK
Vote:
 

In case someone stumbles upon it in 2020, the Commerce (EPiServer.Business.Commerce.dll) has the Decimal implementation located in EPiServer.Commerce.SpecializedProperties.PropertyDecimal. It uses [PropertyDefinitionTypePlugIn] Attribute. Just copy over that class to your Solution, it should be automatically picked up.

#217022
Feb 13, 2020 6:24
* 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.