Unfortunately, after importing the class, not just the namespace, it
still threw an error. I went ahead and just created a small helper
that then called my extension method.
Thanks Ayende and Joao for the help.
Jason
PS Here is the exception that I get if it at all illuminates the
actual problem.
Type: MonoRailException
Message: Exception on process view: search\index
Last accessed variable: projects
StackTrace:
at Castle.MonoRail.Views.Brail.BooViewEngine.HandleException(String
templateName, BrailBase view, Exception e) in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\MonoRail\Castle.MonoRail.Views.Brail\BooViewEngine.cs:line
281
at Castle.MonoRail.Views.Brail.BooViewEngine.RenderView(String
templateName, BrailBase view) in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\MonoRail\Castle.MonoRail.Views.Brail\BooViewEngine.cs:line
172
at Castle.MonoRail.Views.Brail.BooViewEngine.Process(String
templateName, TextWriter output, IEngineContext context, IController
controller, IControllerContext controllerContext) in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\MonoRail\Castle.MonoRail.Views.Brail\BooViewEngine.cs:line
153
at Castle.MonoRail.Framework.Services.DefaultViewEngineManager.Process(String
templateName, TextWriter output, IEngineContext context, IController
controller, IControllerContext controllerContext) in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\MonoRail\Castle.MonoRail.Framework\Services\DefaultViewEngineManager.cs:line
164
at Castle.MonoRail.Framework.Controller.ProcessView() in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\MonoRail\Castle.MonoRail.Framework\Controller.cs:line
1845
at
Castle.Proxies.SearchControllerProxy7ce27b4affa44da8a9ace9f6fe59f1a5.ProcessView_callback_18()
at
Castle.Proxies.SearchControllerProxy7ce27b4affa44da8a9ace9f6fe59f1a5.InvocationProcessView_18.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed() in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\Tools\Castle.DynamicProxy2\Castle.DynamicProxy\AbstractInvocation.cs:line
188
at Intel.TraX.Libraries.Data.StopWatchInterceptor.Intercept(IInvocation
invocation) in C:\projects\cost\trax\Libraries\Data\StopWatchInterceptor.cs:line
25
at Castle.DynamicProxy.AbstractInvocation.Proceed() in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\Tools\Castle.DynamicProxy2\Castle.DynamicProxy\AbstractInvocation.cs:line
197
at
Castle.Proxies.SearchControllerProxy7ce27b4affa44da8a9ace9f6fe59f1a5.ProcessView()
at Castle.MonoRail.Framework.Controller.RunActionAndRenderView() in
c:\TeamCity\buildAgent\work\7e4107d1782544ec\MonoRail\Castle.MonoRail.Framework\Controller.cs:line
1709
On Wed, Aug 26, 2009 at 4:53 AM, Ayende Rahien<[email protected]> wrote:
> I think that if you import the static class, it should work for extension
> methods
>
> 2009/8/26 João Bragança <[email protected]>
>>
>> AFAIK you can't use them the same way you would in C#. You can import
>> the static class and just use the method as if it were a function.
>> <?brail import My.Library.Extensions.MyStaticClass ?>
>>
>> ${AsWW(datetime)}
>>
>>
>> On Aug 25, 3:32 pm, jsmorris <[email protected]> wrote:
>> > Can I use c# extension methods in brail code? I am getting an error
>> > when I try.
>> >
>> > I have extended the DateTime object to have an AsWW method that
>> > encapsulates my company's custom calculation of the week of the year.
>> >
>> > In my view, I have placed the import to my extension library and then
>> > tried to call the method, but I receive an error each time.
>> >
>> > <?brail import My.Library.Extensions ?>
>> >
>> > ....
>> >
>> > ${ datetime.AsWW() }
>> >
>> > ....
>> >
>> > I know that I can get around this by using a Helper, ViewComponent, or
>> > even an extension of Boo, but was wondering if this is possible.
>> >
>> > My Google search didn't turn up anything.
>> >
>> > Thanks,
>> > Jason
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---