Skip to main content
Home  ›  Blog

Fixing the Breaking Change On ToSic.Eav.IEntity in 2sxc 9.3

In 2sxc 9.3 we were forced to introduce a breaking change which should affect very few, but if you are affected it's about the IEntity - here's how to fix it.

Update: as of 2sxc 10.20, please use this new recommendation in the docs.

Why a breaking change?

We try to avoid this at all cost, but there are cases where we must judge whether it's worse to keep something bad - knowing it will be used more and more - or to fix it - so that future uses will do it right. 

In this specific case, all interfaces (things starting with a capital "i") were in a namespace called ToSic.Eav.Interfacesexcept for the IEntity, which for historic reasons was in ToSic.Eav. We believe that it's rarely used - so we decided to fix this, so that future code wouldn't be inconsistent. 

Fixing This If You Have Old Code

Only do this if you have old code, and believe that you are affected. 

Basically, if you have razor templates containing ToSic.Eav.IEntity OR if you have code which has a @using ToSic.Eav; as one of the first lines, and you run into an errer, this is for you. 

  • Just change ToSic.Eav.IEntity to ToSic.Eav.Interfaces.IEntity and you're good to go. 
  • Just change @using ToSic.Eav; to @using ToSic.Eav.Interfaces;

Hope that helps!

This is What You See if you're affected

We've included a typical error-message so that google will bring you here if you're searching. 

Message from 2sxc 9.3 to 2sxc 9.11

Error: System.Web.HttpCompileException (0x80004005): ...\Web\Portals\...\2sxc\...\_....cshtml(5): error CS0234: The type or namespace name 'IEntity' does not exist in the namespace 'ToSic.Eav' (are you missing an assembly reference?) at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at ToSic.SexyContent.Engines.RazorEngine.CreateWebPageInstance() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 71 at ToSic.SexyContent.Engines.RazorEngine.InitWebpage() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 93 at ToSic.SexyContent.Engines.RazorEngine.Init() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 26 at ToSic.SexyContent.Engines.EngineBase.Init(Template template, App app, ModuleInfo hostingModule, IDataSource dataSource, InstancePurposes instancePurposes, SxcInstance sxcInstance, Log parentLog) in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\Engines\EngineBase.cs:line 58 at ToSic.SexyContent.SxcInstance.GetRenderingEngine(InstancePurposes renderingPurpose) in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\SxcInstance.cs:line 266 at ToSic.SexyContent.SxcInstance.Render() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\SxcInstance.cs:line 228

Message in 2sxc 9.12+

In 2sxc 9.12 we added a special detection to guide users to this blog-post:

Error: System.Exception: Error in your razor template. You are seeing this because 2sxc 9.3 has a breaking change on ToSic.Eav.IEntity. It's easy to fix - please read https://2sxc.org/en/blog/post/fixing-the-breaking-change-on-tosic-eav-ientity-in-2sxc-9-3 . What follows is the internal error: ---> System.Web.HttpCompileException: c:\Projects\2SexyContent\Web\Portals\x960\2sxc\Simple Parent-Child with 2 pages\_Answer.cshtml(7): error CS0234: The type or namespace name 'IEntity' does not exist in the namespace 'ToSic.Eav' (are you missing an assembly reference?) at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at ToSic.SexyContent.Engines.RazorEngine.CreateWebPageInstance() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 99 --- End of inner exception stack trace --- at ToSic.SexyContent.Engines.RazorEngine.ProvideSpecialErrorOnIEntityIssues(Exception maybeIEntityCast) in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 81 at ToSic.SexyContent.Engines.RazorEngine.CreateWebPageInstance() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 107 at ToSic.SexyContent.Engines.RazorEngine.InitWebpage() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 125 at ToSic.SexyContent.Engines.RazorEngine.Init() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 27 at ToSic.SexyContent.Engines.EngineBase.Init(Template template, App app, ModuleInfo hostingModule, IDataSource dataSource, InstancePurposes instancePurposes, SxcInstance sxcInstance, Log parentLog) in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\Engines\EngineBase.cs:line 58 at ToSic.SexyContent.SxcInstance.GetRenderingEngine(InstancePurposes renderingPurpose) in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\SxcInstance.cs:line 266 at ToSic.SexyContent.SxcInstance.Render() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\SxcInstance.cs:line 228


Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 800 DNN projects since 1999. He is also chief architect of 2sxc (see github), an open source module for creating attractive content and DNN Apps.

Read more posts by Daniel Mettler