This project is read-only.

Config question

Topics: Developer Forum
Mar 5, 2008 at 12:18 PM
Hei libardo!

I made my own versions of urlrewriting and urlparsing (main reason was to inject language information from url). I havn't any experience with castle before, so i was little bit confused how would be best way to configure engine to use my versions. In example can i override DefaultUrlParser and UrlRewriter somehow from web.config or do i have to change web.castle.config for that (i feel like losing some plugability with this option)?

Well actually i have one more question. Any experience with n2cms in webfarm? Anything that could fail?

I have been playing with n2cms for some time now and starting to like it little bit more every day. I would love to contribute if i manage to create something useful. Do you have some guideline for submissions? I found to-do list on www.n2cms.com website, is it up to date?

Regards

Mar 5, 2008 at 5:10 PM
Hi there,

Too change a service you can either replace the existing service in the xml or make sure to configure another service before an existing one. E.g. to replace the default url rewriter you could add an include before the default ones in web.config:

<castle>
	<!-- bunch of properties -->
	<!-- my-configuration takes precedence since it's configured before -->
	<include uri="file:/my-configuration.config"/>
	<include uri="assembly://N2/Engine/n2.configuration.xml"/>
	<!-- here it's possible to change parameters on existing services -->
</castle>
my-configuration.config example:
<castle>
	  <components>
		  <component id="n2.sitesProvider" service="N2.Web.ISitesProvider, N2" type="N2.Web.DynamicSitesProvider, N2" />
		  <component id="n2.urlParser.multipleSite" service="N2.Web.IUrlParser, N2" type="N2.Web.MultipleHostsUrlParser, N2" />
	  </components>
</castle>

I figure n2 should work okay in a webfarm. That assuming that cache invalidation has been handled somehow or quick updates aren't a priority. I would like to hear about any experiences from the field.

I update that list every now and then but the most recent list is checked in here.

I'm certanly interested in contributions to the project. Seeing N2 growing without me sweating is a dream of mine =) To start the easiest way would be to:
  • get the head revision from the svn repository using e.g. tortoise svn
  • apply your improvements
  • creating a patch and either upload it here in the issue tracker or mail to me
  • there is also a mailing list if that makes it easier to discuss implementation details

If you're aspiring for write permissions then the most important aspects are:
  • Modularity (code should be in a place that fits, e.g. nothing overly specific in the core)
  • Code coherence (at least the public api of the code should adhere to the existing style, or improve upon it in a constructive way. unless it's stuff like examples, guidance or contrib)
  • Tests (i.e. unit tests)
  • Track record (need to see some stuff to trust things won't get wrecked)

/Cristian