Hi,
I'm currently developping configuration in FluentNHibernate.Search but
i don't see how can i buildup NHS configuration without xml.
I'm looking in the CfgHelper class which is called (through some
anothers classes) by the FullTextIndexEventListener and it seems that
there is no abstraction with the INHSConfiguration.
Configure method take a NH Configuration object, but since the
"configCollection" is null it will call the LoadConfiguration method,
so finally will get configuration from xml file.
It's highly dependant of XML configuration ... and i don't see how can
get around that.
/// <summary>
/// Return NHibernate.Search Configuration. Loaded using the
<c><nhs-configuration></c> section
/// from the application config file, if found, or the file
<c>nhsearch.cfg.xml</c> if the
/// <c><nhs-configuration></c> section is not present.
/// If neither is present, then a blank NHSConfiguration is
returned.
/// </summary>
public static INHSConfigCollection LoadConfiguration()
{
INHSConfigCollection nhshc =
ConfigurationManager.GetSection(CfgXmlHelper.CfgSectionName) as
INHSConfigCollection;
if (nhshc != null)
{
return nhshc;
}
if (!ConfigFileExists(configFilePath))
{
return new NHSConfigCollection();
}
using (XmlTextReader reader = new
XmlTextReader(configFilePath))
{
return new NHSConfigCollection(reader);
}
}
public static void Configure(Configuration cfg)
{
if (configCollection == null)
{
configCollection = LoadConfiguration();
}
string sessionFactoryName = string.Empty;
if
(cfg.Properties.ContainsKey(NHibernate.Cfg.Environment.SessionFactoryName))
{
sessionFactoryName =
cfg.Properties[NHibernate.Cfg.Environment.SessionFactoryName];
}
INHSConfiguration configuration =
configCollection.GetConfiguration(sessionFactoryName);
if (configuration == null)
{
return;
}
foreach (KeyValuePair<string, string> pair in
configuration.Properties)
{
cfg.Properties.Add(pair.Key, pair.Value);
}
}
--
You received this message because you are subscribed to the Google Groups
"NHibernate Contrib - Development Group" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhcdevs?hl=en.