My company has several sites that link to the same base code library. Then we have a CMS that manages the data.
In the Core library, I have a site class that contains a bunch of basic information about each site. This is the smooth display that I have for him.
using Core.Model; // Where Site class exists namespace Core.Repository.NHibernate.Mappings { public class SiteMapping : ClassMap<Site> { public SiteMapping() { Table("f_site"); Id(x => x.Id, "f_site_id").GeneratedBy.Identity(); Map(x => x.Domain, "domain_name").Not.Nullable(); } } }
As part of the CMS, we keep a journal that edited what and when. But I only want to have a link to the class and journal mapping in CMS, and not to my main code, since people can edit information only through CMS.
Here is my current current mapping to the Log class, which references the site class.
using Core.Model; // where Site class exists using Cms.Model; // where Log and CmsUser classes exists namespace Cms.Repository.NHibernate.Mappings { public class LogMapping : ClassMap<Log> { public LogMapping() { Table("f_log"); Id(x => x.Id, "f_log_id").GeneratedBy.Identity(); Map(x => x.Message, "message"); Map(x => x.LogType, "d_log_type_id").CustomType<LogType>(); Map(x => x.LogOperation, "d_log_operation_id").CustomType<LogOperation>(); Map(x => x.Date, "log_date"); References<Site>(x => x.Site, "f_site_id") .ForeignKey("f_site_id") .Cascade.None(); References<CmsUser>(x => x.User, "userId") .ForeignKey("userId") .Cascade.None(); } } }
In theory, this works fine, but Log display errors with the following
Cms.Tests.Repository.NHibernate.Repository.TestLogRepository.TestLogMappings: StructureMap.StructureMapException : StructureMap Exception Code: 207 Internal exception while creating Instance 'e46153a3-2bfe-4279-8749-a42d7a6dd10c' of PluginType Core.Repository.NHibernate.SessionStorage.ISessionContainer`1[[HbmCms.Repository.NHibernate.Mappings.Config.LogMapping, Cms.Repository.NHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Core.Repository.NHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Check the inner exception for more details.
Does anyone know how to configure CMS mapping to map the main site? This is the first bit of code that gets matched across two projects, but this is what we will be doing honestly, like so many things that you just look at and do in the CMS. I really don't want to put only CMS code in the Core library if I can avoid it.
thanks for the help
Sandra