I am trying to migrate a V1.2 app to V2.1.2. Previously I could save my HQL queries in embedded XML files then load them like this:
configuration.AddXmlString(ReadMyFileFromAssemblyUsingReflection("MyQueries.xml"));
where ReadMyFile... is a function that gets the embedded XML from the assembly etc etc and passes it to the Configuration as a string. The xml was then added using configuration.AddXmlString(<string from xml file>)
This worked fine before in v1.2.
In V2.1.2:
The code that reads the xmls executes without error. (Of course, is not NHibernate code, it should still work the same).
After reading in the XML, the calls to Configuration.AddXmlString() also complete. Then, if I check the configuration.NamedQueries property through the debugger, gthe collection is correctly populated and indicates the XML was in fact loaded as named queries.
But an exception is thrown as soon as I try to get the factory:
Object reference not set to an instance of an object. at NHibernate.Engine.Query.QueryPlanCache.HQLQueryPlanKey..ctor(String query, Boolean shallow, IDictionary2 enabledFilters) at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String queryString, Boolean shallow, IDictionary2 enabledFilters) at NHibernate.Impl.SessionFactoryImpl.CheckNamedQueries() at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) at NHibernate.Cfg.Configuration.BuildSessionFactory() at Car.Emr.RepositoryTests.TestSession
Removing the section where the queries are read in eliminates the above error, but of course it also eliminates my required query information.
TIA
|