This project is read-only.

Release 1.4 - configuration changes

Topics: Developer Forum
Jun 21, 2008 at 3:49 PM

Within release 1.4 configuration sections are used, and there are some problems for me.
I've used custom UrlParser and DynamicSitesProvider, which I've noticed before

So now it's very hard to replace standart UrlParser and SitesProvider classes, because following construction doesn't work anymore:

<castle><components><component id="n2.sitesProvider" service="N2.Web.ISitesProvider, N2" type="MyDynamicSitesProvider, N2.MyExtension" /><component id="n2.urlParser.multipleSite" service="N2.Web.IUrlParser, N2" type="MyMultipleHostsUrlParser, N2.MyExtension" /></components></castle>

Only way i did found to replace them is to create my own IEngine implementation, for example inherited from ContentEngine, may be there is a simpler one?

There is a bug in ContentEngine.DetermineResource method, at line 134, call config.GetSection("castle") always returns DefaultConfigSection, and never CastleSectionHandler (i don't understand why). So castle configuration is always ignored.
Also there is inconsistence in documentation on web site
Stated Web.config changes are not working now.
Jun 21, 2008 at 5:01 PM
Hi. Thank you for bringing this up. I'll look into this.

A possible workaround would be defining a multipleSitesConfiguration:
  1. Put your component registrations in a separate file, e.g. SiteProviders.config and compile it as an embedded resource.
  2. Point it out from <n2><engine multipleSitesConfiguration="assembly://My/SiteProviders.config" ...
Jun 23, 2008 at 10:23 AM
Thanks, that works.