Archive

Archive for June, 2006

Castle Monorail – Moving from Beta5 to latest build

29 June, 2006 Comments off

I’ve decided to move my “toy” MonoRail project from the Beta 5 version to the latest build so I can have a play with the new features. Mostly Formhelper!

Moving to the latest build broke a few things in my solution:

The Build

Nunit framework

My web test project was using Nunit version 2.2.0.0. Which is used by Castle.MonoRail.TestSupport I believe although don’t quote me on that I could be wrong. Any who it now requires the latest version of the nunit.framework.dll (2.2.8.0). I change the reference and all was well.

DataBindAttribute
Next up was the DataBindAttribute which appears to have changs slightly. I did have:

public void LoginSubmit([DataBind(Prefix = "student")] Student student)

It appears the Prefix parameter is now explicit, a simple change:

public void LoginSubmit([DataBind("student")] Student student)

The Tests

Ok now my solution builds but all of my ActiveRecord unit tests fail. I get the following error:

TestFixture failed: You can't invoke ActiveRecordStarter.Initialize more than once

Turns out to be a problem in the InitFramework method of my AbstractModelTestCase class. Initalialze is being called twice:

protected virtual void InitFramework()
{
IConfigurationSource source = ConfigurationManager.GetSection("activerecord") as IConfigurationSource;

ActiveRecordStarter.Initialize(source);

ActiveRecordStarter.Initialize( source, typeof(Student), typeof(LoginAudit) );
}

I guess there is now no need for the first ActiveRecordStarter.Initialize(source); call so I remove it and all is well!

The Run

Ok now my solution builds and passes the test but all is not well at run time I get the following error:

Looks like you forgot to register the http module Castle.MonoRail.Framework.EngineContextModule
Add '<add name="monorail" type="Castle.MonoRail.Framework.EngineContextModule, Castle.MonoRail.Framework" />' to the <httpModules> section on your web.config

This is a breaking change mentioned in the release notes and you must update your web.config. But don’t get your httpModules and your httpHandlers mixed up as I did. Simply add the httpModules to your web.config:

<system.web>
<httpHandlers>
<add verb="*" path="*.aspx" type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory, Castle.MonoRail.Framework" />
</httpHandlers>
<httpModules>
<add name="monorail" type="Castle.MonoRail.Framework.EngineContextModule, Castle.MonoRail.Framework" />
</httpModules>
</system.web>

The End

That’s it we’re down! Now I get to play with the latest version.

Categories: MonoRail

Castle Monorail – NVelocity View Engine

22 June, 2006 8 comments

I’m using the recommended view engine NVelocity.

The following objects are available to the view code:
• context (IRailsEngineContext)
• request
• response
• session
• All entries in the request (if any)
• All entries in the Flash (if any)
• All entries in the PropertyBag (if any)

Also, a siteRoot string is added so you can build url definitions like:
$siteRoot/home/index.rails
<img src="$siteRoot/images/someimage.gif" />

Notation (variable name):

$ [ ! ][ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ][ } ]

Examples:

  • Normal notation: $mud-Slinger_9
  • Silent notation: $!mud-Slinger_9
  • Formal notation: ${mud-Slinger_9}

Loops
#foreach($i in $items)
#each (this is optional since its the default section)
text which appears for each item
#before
text which appears before each item
#after
text which appears after each item
#between
text which appears between each two items
#odd
text which appears for every other item, including the first
#even
text which appears for every other item, starting with the second
#nodata
Content rendered if $items evaluated to null or empty
#beforeall
text which appears before the loop, only if there are items
matching condition
#afterall
text which appears after the loop, only of there are items
matching condition
#end

Binary expressions
#if($order.Status == "Undefined")
Sorry, but we don't know this order.
#elseif($order.Status == "Created")
Your order is being processed. Hold on!
#elseif($order.Status == "Dispatched")
Your order has been dispatched through UPS. Cross your fingers!
#end

IDictonary Parameters
Calling a helper with IDictonary Paramaters:
$HtmlHelper.SubmitButton("Login", $DictHelper.CreateDict("id=btnLogin"))

Categories: MonoRail

Castle MonoRail

22 June, 2006 Comments off

I’m taking a look at a .net implementation of Ruby on Rails called Monorail. It’s part of the Castle project. So far it looks pretty good!

Community
Mail List – Although I haven’t been able to get signed up on this yet! There is an archive though.
Forum – Just lurking at the moment.

Source
https://svn.castleproject.org/svn/castle/trunk/

Daily builds
http://www.castleproject.org/~ayende/

Categories: MonoRail

Subversion, TortoiseSVN and the _SVN ASP.NET Hack

7 June, 2006 Comments off

Good write up of the TortoiseSVN ASP.NET Hack here

Basically involves creating an environment variable SVN_ASP_DOT_NET_HACK with the value of 1. When TortoiseSVN finds this variable it looks for _svn folder instead of .svn

Categories: Subversion

Location of XML files

6 June, 2006 Comments off

http://YOUR SERVER NAME:50000/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/

documents\portalResource\USER.R3_DATASOURCE.[user id]

Categories: SAP Enterprise Portal