Hi,
I get the following error on application start up for any page that has the xpMetaDataModule attached to a section:
in expected: m [from MetaData m where m.ModuleType = :type and m.ObjectUID = :ouid]
The code is as follows:
string hql = "from MetaData m where m.ModuleType = :type and m.ObjectUID = :ouid";
IQuery q = base.NHSession.CreateQuery(hql);
q.SetString( "type", moduleType );
q.SetInt32("ouid", ouid );
q.SetCacheable(true);
q.SetCacheRegion("xpMetaData");
foreach( MetaData meta in q.List() )
{
col.Add( meta );
}
return col;
The line q.List() causes the error. The exception handler had the following comment:
// we must trap the error. When the application start the first query call generate an error
// No ideas
I have no idea what this is. Has anyone any ideas??
Thanks
Paul
It might be possible that the module does not set the SessionFactoryRebuilt flag so Cuyahoga doesn't know that the sessionfactory has some new classes added and the request just continues with the old session. Cuyahoga 1.x checks this flag and reloads the page once it notices that something has changed.
This is how the Downloads module does it:
SessionFactory sf = SessionFactory.GetInstance();
// Register classes that are used by the DownloadsModule
sf.RegisterPersistentClass(typeof(Cuyahoga.Modules.Downloads.Domain.File));
base.SessionFactoryRebuilt = sf.Rebuild();
Note that this behaviour has changed in the current trunk version where you don't have to set the flag anymore.
Hi,
That is the behaviour that is already in the constructor of xpMetaData:
SessionFactory sf = SessionFactory.GetInstance();
// Register classes that are used by the ArticleModule
sf.RegisterPersistentClass(typeof(Cuyahoga.Modules.xpMetaData.Domain.MetaData));
base.SessionFactoryRebuilt = sf.Rebuild();
try
{
// get settings
if (IsValidSettings( Section.Settings["INCLUDE_DEFAULTS"] ) )
{
this._defaults = Boolean.Parse(Section.Settings["INCLUDE_DEFAULTS"] as string);
}
if (IsValidSettings(Section.Settings["ALTERNATE_CONFIG_FILE"]))
{
this._defaultsFile = (string)Section.Settings["ALTERNATE_CONFIG_FILE"];
}
}
// this is required for the first initialization on application start
catch {}
I am totally baffled.
Paul
Hi,
The doumentation states that one module can be attached to the template.
It does not state how this is possible.
The only way I could see this working is via a standalone section. Is this what the documentation means??
I have tried attaching as a standalone section but the metadata does not appear.
Can anyone clarify this?
Thanks
Paul
Hi,
I did get it working with this approach although in the version of the code I am using, the module was not overriding ReadSectionSettings.
Once I did that with the following code all is OK.
public override void ReadSectionSettings()
{
_defaults = bool.Parse(Section.Settings["INCLUDE_DEFAULTS"].ToString());
}
I downloaded the code from the art experience website.
Is this the most recent version of the code??
Thanks
Paul
I don't know if this is of any help, but integration of the xpMetaData module in Cuyahoga is short on the todo-list. First the xpGallery has to be converted to Cuyahoga 2.0 and after that, it's the xpMetaData module's turn.
Hi,
We used the XpMetadata in our latest project.
The only way we could get round this program was to add the assembly to the assemblies element in the ~/config/facilities.config.
We also added the module class to the ~/config/services.config file.
The problem never reappeared then.
Paul
Hmm, for some reason it never came up to me that you might be working with the current SVN version of Cuyahoga.
Module controllers now have to implement a marker interface INHibernateModule and their mappings will be automatically added. Might be worth a try.
Btw, the xpGallery module is ported to 2.0, but now I'm having a strange issue with my dev environment that suddenly doesn't recognize a binding redirect anymore. When that is fixed, the Gallery goes into SVN.