Tring to follow the tutorial.... get error
Hello,
I'm tring to follow the custom module tutorial on the "Sitefinity 4 Developer Guide", the paragraph "How to create a custom content-based module" ... I've followed everything but I got an error and a question ...
the error is
No metadata has been registered for class xxxx. (This usually indicates, that either this class is not declared persistent or it is declared persistent but not enhanced. The class was loaded from file:///C:/Projects/SF/bin/xxx.DLL.)
<ProjectExtensions> <VisualStudio> <UserProperties OpenAccess_EnhancementOutputLevel="1" OpenAccess_UpdateDatabase="False" OpenAccess_Enhancing="False" OpenAccess_ConnectionId="DatabaseConnection1" OpenAccess_ConfigFile="App.config" /> </VisualStudio> </ProjectExtensions> <PropertyGroup> <OpenAccessPath>$(SolutionDir)\..\..\..\..\..\Common\Dependencies</OpenAccessPath> </PropertyGroup> <Import Condition="Exists('$(OpenAccessPath)\OpenAccess.targets')" Project="$(OpenAccessPath)\OpenAccess.targets" />
the following line:
<
Import
Condition
=
"Exists('$(OpenAccessPath)\OpenAccess.targets')"
Project
=
"$(OpenAccessPath)\OpenAccess.targets"
/>
Hello,
I wrongly reported in the thread... I've added to the csproj.... but in the App.Config should I define what the mapping is?
Thanks
Paolo
if you are using Sitefinity 4.1 or later, the mappings are now handled using the new OpenAccess fluent mapper and are no longer defined in web.config. This is explained in this section:
http://www.sitefinity.com/40/help/developers-guide/how-to-how-to-create-a-custom-content-based-module-implementing-the-provider-pattern-creating-the-fluent-mappings.html
Fluent mappings replace the old app.config way of mapping classes to the database. Here is video series I found very helpful in making sense of this new concept
http://tv.telerik.com/series/getting-started-with-fluent-mapping-for-openaccess-orm
I find the fluent mapping to be a big improvement in developing data-persistent objects, so if you're not yet on 4.1 I encourage you to upgrade so you can take advantage of it and not worry about the app.config anymore :)
hope this was helpful!
Hello,
yes I'm using 4.1 ... but I've to create the table in the DB?
Thanks
the fluent mapping automatically handles creating the database and mapping it to your object when the module is initialized. you shouldn't have to access the database at all. that's the benefit of using openaccess :)
Ok, I should be ok with the openaccess... now I got another problem regarding the custom template....
I've defined this :
namespace SitefinityWebApp
public class Global : System.Web.HttpApplication
protected void Application_Start(object sender, EventArgs e)
Telerik.Sitefinity.Abstractions.Bootstrapper.Initializing += new EventHandler<
Telerik.Sitefinity.Data.ExecutingEventArgs
>(Bootstrapper_Initializing);
protected void Bootstrapper_Initializing(object sender, Telerik.Sitefinity.Data.ExecutingEventArgs args)
if (args.CommandName == "RegisterRoutes")
var virtualPathConfig = Config.Get<
VirtualPathSettingsConfig
>();
var jobsModuleVirtualPathConfig = new VirtualPathElement(virtualPathConfig.VirtualPaths)
VirtualPath = "~/UC/*",
ResolverName = "EmbeddedResourceResolver",
ResourceLocation = "SitefinityWebApp"
;
virtualPathConfig.VirtualPaths.Add(jobsModuleVirtualPathConfig);