Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# greyd 4/26/2008 10:19 PM
Hey guys,

I believe have already been seen this message before at this forum

The fact: I rebuilt Cuyahoga.Core with little some modifications at ModuleLoader and SessionHelper... (only some experiments). after this, i give the message

"in expected: s [from StaticHtmlContent s where s.Section.Id = ? ]".

After reload official version of Core everything works again...
My modifications :

Some help will be very appreciated


//New experimental method
public void AddAssembly(string fatoryKey, Assembly assembly) {
// New kernel query
Configuration nhConfiguration = this._kernel[fatoryKey] as Configuration;
// Old kerney query
Configuration nhConfiguration = this._kernel[typeof(Configuration)] as Configuration;

nhConfiguration.AddAssembly(assembly, true);
ISessionFactory newSessionFactory = nhConfiguration.BuildSessionFactory();
ReplaceSessionFactory(fatoryKey, newSessionFactory);
}

//Overload to keep current behaviour
public void AddAssembly(Assembly assembly){
AddAssembly("nhibernate.factory", assembly);
}

private void cuyahogaSessionFactory_SessionFactoryRebuilt(object sender, EventArgs e){
ISessionFactory newNhSessionFactory = ((SessionFactory)this._kernel[typeof(SessionFactory)]).GetNHibernateFactory();
ReplaceSessionFactory("nhibernate.factory", newNhSessionFactory);
}

private void ReplaceSessionFactory(string fatoryKey, ISessionFactory nhSessionFactory){
this._kernel.RemoveComponent(fatoryKey);
this._kernel.AddComponentInstance(fatoryKey, nhSessionFactory);
}


# martijnb 4/27/2008 9:53 PM
greydpublic void AddAssembly(string fatoryKey, Assembly assembly) {
// New kernel query
Configuration nhConfiguration = this._kernel[fatoryKey] as Configuration;
// Old kerney query
Configuration nhConfiguration = this._kernel[typeof(Configuration)] as Configuration;

nhConfiguration.AddAssembly(assembly, true);
ISessionFactory newSessionFactory = nhConfiguration.BuildSessionFactory();
ReplaceSessionFactory(fatoryKey, newSessionFactory);
}

You're assigning two configurations to the same variable. This seems a little useless, doesn't it?
# greyd 4/28/2008 12:01 AM (edited 4/28/2008 12:04 AM)
The code piece it's wrong. It's really commented
martijnbpublic void AddAssembly(string fatoryKey, Assembly assembly) {
// New kernel query
Configuration nhConfiguration = this._kernel[fatoryKey] as Configuration;
// Old kerney query
// Configuration nhConfiguration = this._kernel[typeof(Configuration)] as Configuration;

nhConfiguration.AddAssembly(assembly, true);
ISessionFactory newSessionFactory = nhConfiguration.BuildSessionFactory();
ReplaceSessionFactory(fatoryKey, newSessionFactory);
}

You're assigning two configurations to the same variable. This seems a little useless, doesn't it?
# martijnb 4/28/2008 9:23 AM
I can't immediately see what's wrong. Could you debug it and see to which sessionfactory StaticHtml is added? Probably the session factories get mixed up somewhere.