Contrib Code Generator

View: New views
13 Messages — Rating Filter:   Alert me  

Contrib Code Generator

by Lee Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've updated the code generator for use with the latest routing stuff.
It's hacked together a bit, and I'm pretty sure I don't quite grasp
exactly all the nuances of the routing engine.

[StaticRoute("Products", "products")]
public void ProductsList()
{
}

Accessible via: Routes.Products()
Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)

[PatternRoute("Product", "products/<productKey:guid>")]
public void Product(Guid productKey)
{
}

Accessible via: Routes.Product(new Guid())
Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)

[PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
<zoo>/[beep]", "thing=this")]
public void Parp(Guid foo, int bar, string zoo, string beep)
{
}

Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Adam Tybor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Can I get contrib commit access?  One thing I noticed is that using
int as validation try's to call ValidInt instead of ValidInteger.  I
am also missing the MyRoutes now and Site.Routes.

On Jan 17, 2008 1:19 PM, Lee Henson <lee.m.henson@...> wrote:

>
> I've updated the code generator for use with the latest routing stuff.
> It's hacked together a bit, and I'm pretty sure I don't quite grasp
> exactly all the nuances of the routing engine.
>
> [StaticRoute("Products", "products")]
> public void ProductsList()
> {
> }
>
> Accessible via: Routes.Products()
> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>
> [PatternRoute("Product", "products/<productKey:guid>")]
> public void Product(Guid productKey)
> {
> }
>
> Accessible via: Routes.Product(new Guid())
> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>
> [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
> <zoo>/[beep]", "thing=this")]
> public void Parp(Guid foo, int bar, string zoo, string beep)
> {
> }
>
> Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by James Curran-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Email Hamilton with the Userid/Password you want.  Of course, with the current server issues, there may be a delay....

On Jan 18, 2008 1:11 PM, Adam Tybor <adam.tybor@...> wrote:

Can I get contrib commit access?  One thing I noticed is that using
int as validation try's to call ValidInt instead of ValidInteger.  I
am also missing the MyRoutes now and Site.Routes.




--
Truth,
   James

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Lee Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> One thing I noticed is that using
> int as validation try's to call ValidInt instead of ValidInteger.

Fixed.

> I am also missing the MyRoutes now and Site.Routes.

Yeah I've commented out the MyRoutes as it felt a bit wrong to
associate routes with a specific controller. I think I've probably
been overzealous there though. It's easy enough to add back in though.
Site.Routes doesn't exist I don't think, it's just
Routes.<RouteName>()

I'm off to the Alps now for a week, so I look forward to lots of
improvements when I get back! ;p

On 18 Jan, 18:11, "Adam Tybor" <adam.ty...@...> wrote:

> Can I get contrib commit access?  One thing I noticed is that using
> int as validation try's to call ValidInt instead of ValidInteger.  I
> am also missing the MyRoutes now and Site.Routes.
>
> On Jan 17, 2008 1:19 PM, Lee Henson <lee.m.hen...@...> wrote:
>
>
>
> > I've updated the code generator for use with the latest routing stuff.
> > It's hacked together a bit, and I'm pretty sure I don't quite grasp
> > exactly all the nuances of the routing engine.
>
> > [StaticRoute("Products", "products")]
> > public void ProductsList()
> > {
> > }
>
> > Accessible via: Routes.Products()
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>
> > [PatternRoute("Product", "products/<productKey:guid>")]
> > public void Product(Guid productKey)
> > {
> > }
>
> > Accessible via: Routes.Product(new Guid())
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>
> > [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
> > <zoo>/[beep]", "thing=this")]
> > public void Parp(Guid foo, int bar, string zoo, string beep)
> > {
> > }
>
> > Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Ken Egozi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you mean "Apls.NET"? is that the yet new name for the altnet user group?

;)

have fun.


On Jan 19, 2008 12:24 AM, Lee Henson <lee.m.henson@...> wrote:

> One thing I noticed is that using
> int as validation try's to call ValidInt instead of ValidInteger.

Fixed.

> I am also missing the MyRoutes now and Site.Routes.

Yeah I've commented out the MyRoutes as it felt a bit wrong to
associate routes with a specific controller. I think I've probably
been overzealous there though. It's easy enough to add back in though.
Site.Routes doesn't exist I don't think, it's just
Routes.<RouteName>()

I'm off to the Alps now for a week, so I look forward to lots of
improvements when I get back! ;p

On 18 Jan, 18:11, "Adam Tybor" <adam.ty...@...> wrote:
> Can I get contrib commit access?  One thing I noticed is that using
> int as validation try's to call ValidInt instead of ValidInteger.  I
> am also missing the MyRoutes now and Site.Routes.
>
> On Jan 17, 2008 1:19 PM, Lee Henson <lee.m.hen...@...> wrote:

>
>
>
> > I've updated the code generator for use with the latest routing stuff.
> > It's hacked together a bit, and I'm pretty sure I don't quite grasp
> > exactly all the nuances of the routing engine.
>
> > [StaticRoute("Products", "products")]
> > public void ProductsList()
> > {
> > }
>
> > Accessible via: Routes.Products()
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>
> > [PatternRoute("Product", "products/<productKey:guid>")]
> > public void Product(Guid productKey)
> > {
> > }
>
> > Accessible via: Routes.Product(new Guid())
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product )
>
> > [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
> > <zoo>/[beep]", "thing=this")]
> > public void Parp(Guid foo, int bar, string zoo, string beep)
> > {
> > }
>
> > Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Ken Egozi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ruined the joke with a typo, damn it
:-0



On Jan 19, 2008 1:51 PM, Ken Egozi <egozi13@...> wrote:
you mean "Apls.NET"? is that the yet new name for the altnet user group?

;)

have fun.



On Jan 19, 2008 12:24 AM, Lee Henson < lee.m.henson@...> wrote:

> One thing I noticed is that using
> int as validation try's to call ValidInt instead of ValidInteger.

Fixed.

> I am also missing the MyRoutes now and Site.Routes.

Yeah I've commented out the MyRoutes as it felt a bit wrong to
associate routes with a specific controller. I think I've probably
been overzealous there though. It's easy enough to add back in though.
Site.Routes doesn't exist I don't think, it's just
Routes.<RouteName>()

I'm off to the Alps now for a week, so I look forward to lots of
improvements when I get back! ;p

On 18 Jan, 18:11, "Adam Tybor" <adam.ty...@...> wrote:
> Can I get contrib commit access?  One thing I noticed is that using
> int as validation try's to call ValidInt instead of ValidInteger.  I
> am also missing the MyRoutes now and Site.Routes.
>
> On Jan 17, 2008 1:19 PM, Lee Henson <lee.m.hen...@...> wrote:

>
>
>
> > I've updated the code generator for use with the latest routing stuff.
> > It's hacked together a bit, and I'm pretty sure I don't quite grasp
> > exactly all the nuances of the routing engine.
>
> > [StaticRoute("Products", "products")]
> > public void ProductsList()
> > {
> > }
>
> > Accessible via: Routes.Products()
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>
> > [PatternRoute("Product", "products/<productKey:guid>")]
> > public void Product(Guid productKey)
> > {
> > }
>
> > Accessible via: Routes.Product(new Guid())
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product )
>
> > [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
> > <zoo>/[beep]", "thing=this")]
> > public void Parp(Guid foo, int bar, string zoo, string beep)
> > {
> > }
>
> > Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Steve Wagner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I think there is a problem in the implementation of the this "Routes.Products()". Example

[PatternRoute("Foo", "feed/foo/<id>")
public void Foo() {}

[PatternRoute("Bar", "feed/bar/<id>")
public void Bar() {}

If i call now Routes.Foo() or Route.Bar() if always get the same url. This is because the generates generates this:

public virtual string Foo(string id) {
  System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
  routeParameters.Add("id", id);
  return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
}

public virtual string Bar(string id) {
  System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
  routeParameters.Add("id", id);
  return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
}

And on my perspective this calls are the same. I think this calls must be look like this:

public virtual string Foo(string id) {
  System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
  routeParameters.Add("id", id);
  return RouteDefinitions.Foo.CreateUrl( routeParameters );
}

public virtual string Bar(string id) {
  System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
  routeParameters.Add("id", id);
  return RouteDefinitions.Foo.CreateUrl( routeParameters );
}

I someone can confirm this i will look forward to write a patch for it.

Steve

Lee Henson schrieb:

> I've updated the code generator for use with the latest routing stuff.
> It's hacked together a bit, and I'm pretty sure I don't quite grasp
> exactly all the nuances of the routing engine.
>
> [StaticRoute("Products", "products")]
> public void ProductsList()
> {
> }
>
> Accessible via: Routes.Products()
> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>
> [PatternRoute("Product", "products/<productKey:guid>")]
> public void Product(Guid productKey)
> {
> }
>
> Accessible via: Routes.Product(new Guid())
> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>
> [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
> <zoo>/[beep]", "thing=this")]
> public void Parp(Guid foo, int bar, string zoo, string beep)
> {
> }
>
> Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Lee Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Steve

Yeah I see that behaviour too. Did you get around to writing a patch?
I can commit it for you.

On Jul 4, 4:12 pm, Steve Wagner <li...@...> wrote:

> I think there is a problem in the implementation of the this "Routes.Products()". Example
>
> [PatternRoute("Foo", "feed/foo/<id>")
> public void Foo() {}
>
> [PatternRoute("Bar", "feed/bar/<id>")
> public void Bar() {}
>
> If i call now Routes.Foo() or Route.Bar() if always get the same url. This is because the generates generates this:
>
> public virtual string Foo(string id) {
>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>   routeParameters.Add("id", id);
>   return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
>
> }
>
> public virtual string Bar(string id) {
>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>   routeParameters.Add("id", id);
>   return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
>
> }
>
> And on my perspective this calls are the same. I think this calls must be look like this:
>
> public virtual string Foo(string id) {
>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>   routeParameters.Add("id", id);
>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>
> }
>
> public virtual string Bar(string id) {
>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>   routeParameters.Add("id", id);
>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>
> }
>
> I someone can confirm this i will look forward to write a patch for it.
>
> Steve
>
> Lee Henson schrieb:
>
> > I've updated the code generator for use with the latest routing stuff.
> > It's hacked together a bit, and I'm pretty sure I don't quite grasp
> > exactly all the nuances of the routing engine.
>
> > [StaticRoute("Products", "products")]
> > public void ProductsList()
> > {
> > }
>
> > Accessible via: Routes.Products()
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>
> > [PatternRoute("Product", "products/<productKey:guid>")]
> > public void Product(Guid productKey)
> > {
> > }
>
> > Accessible via: Routes.Product(new Guid())
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>
> > [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
> > <zoo>/[beep]", "thing=this")]
> > public void Parp(Guid foo, int bar, string zoo, string beep)
> > {
> > }
>
> > Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
> > Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Steve Wagner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ok ive start writing a patch but i could take some time i am really busy
at the moment.

Steve

Lee Henson schrieb:

> Hi Steve
>
> Yeah I see that behaviour too. Did you get around to writing a patch?
> I can commit it for you.
>
> On Jul 4, 4:12 pm, Steve Wagner <li...@...> wrote:
>> I think there is a problem in the implementation of the this "Routes.Products()". Example
>>
>> [PatternRoute("Foo", "feed/foo/<id>")
>> public void Foo() {}
>>
>> [PatternRoute("Bar", "feed/bar/<id>")
>> public void Bar() {}
>>
>> If i call now Routes.Foo() or Route.Bar() if always get the same url. This is because the generates generates this:
>>
>> public virtual string Foo(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
>>
>> }
>>
>> public virtual string Bar(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
>>
>> }
>>
>> And on my perspective this calls are the same. I think this calls must be look like this:
>>
>> public virtual string Foo(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>
>> }
>>
>> public virtual string Bar(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>
>> }
>>
>> I someone can confirm this i will look forward to write a patch for it.
>>
>> Steve
>>
>> Lee Henson schrieb:
>>
>>> I've updated the code generator for use with the latest routing stuff.
>>> It's hacked together a bit, and I'm pretty sure I don't quite grasp
>>> exactly all the nuances of the routing engine.
>>> [StaticRoute("Products", "products")]
>>> public void ProductsList()
>>> {
>>> }
>>> Accessible via: Routes.Products()
>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>>> [PatternRoute("Product", "products/<productKey:guid>")]
>>> public void Product(Guid productKey)
>>> {
>>> }
>>> Accessible via: Routes.Product(new Guid())
>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>>> [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
>>> <zoo>/[beep]", "thing=this")]
>>> public void Parp(Guid foo, int bar, string zoo, string beep)
>>> {
>>> }
>>> Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Lee Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve, I just committed a patch for this. Please verify that this has fixed your problem.

2008/7/10 Steve Wagner <lists@...>:

Ok ive start writing a patch but i could take some time i am really busy
at the moment.

Steve

Lee Henson schrieb:
> Hi Steve
>
> Yeah I see that behaviour too. Did you get around to writing a patch?
> I can commit it for you.
>
> On Jul 4, 4:12 pm, Steve Wagner <li...@...> wrote:
>> I think there is a problem in the implementation of the this "Routes.Products()". Example
>>
>> [PatternRoute("Foo", "feed/foo/<id>")
>> public void Foo() {}
>>
>> [PatternRoute("Bar", "feed/bar/<id>")
>> public void Bar() {}
>>
>> If i call now Routes.Foo() or Route.Bar() if always get the same url. This is because the generates generates this:
>>
>> public virtual string Foo(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
>>
>> }
>>
>> public virtual string Bar(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo, new System.Collections.Hashtable(), routeParameters);
>>
>> }
>>
>> And on my perspective this calls are the same. I think this calls must be look like this:
>>
>> public virtual string Foo(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>
>> }
>>
>> public virtual string Bar(string id) {
>>   System.Collections.IDictionary routeParameters Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>   routeParameters.Add("id", id);
>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>
>> }
>>
>> I someone can confirm this i will look forward to write a patch for it.
>>
>> Steve
>>
>> Lee Henson schrieb:
>>
>>> I've updated the code generator for use with the latest routing stuff.
>>> It's hacked together a bit, and I'm pretty sure I don't quite grasp
>>> exactly all the nuances of the routing engine.
>>> [StaticRoute("Products", "products")]
>>> public void ProductsList()
>>> {
>>> }
>>> Accessible via: Routes.Products()
>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>>> [PatternRoute("Product", "products/<productKey:guid>")]
>>> public void Product(Guid productKey)
>>> {
>>> }
>>> Accessible via: Routes.Product(new Guid())
>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>>> [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
>>> <zoo>/[beep]", "thing=this")]
>>> public void Parp(Guid foo, int bar, string zoo, string beep)
>>> {
>>> }
>>> Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
> >




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Steve Wagner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Lee thanks for doing it! I am too busy at the moment and i could test
it first next week.

I also have a few other things in my head which the generator can be
extend and i list them here. Possibly you find the time and interest to
code them before i get time to do it.

* RouteDefinitions.AddAll(RoutingEngine engine)

* Add a sample project which demonstrates how to use the generator

* Generate a the needed SiteMapControllerBase into SiteMap.generated.cs
    (The Controller which provides access to Site and Routes)

* Routes.Foo should return a IRouteActionReference and
IArgumentlessRouteActionReference insted of a string

* Extend IArgumentlessControllerActionReference with "RouteUrl"

By
Steve

Lee Henson schrieb:

> Steve, I just committed a patch for this. Please verify that this has fixed
> your problem.
>
> 2008/7/10 Steve Wagner <lists@...>:
>
>> Ok ive start writing a patch but i could take some time i am really busy
>> at the moment.
>>
>> Steve
>>
>> Lee Henson schrieb:
>>> Hi Steve
>>>
>>> Yeah I see that behaviour too. Did you get around to writing a patch?
>>> I can commit it for you.
>>>
>>> On Jul 4, 4:12 pm, Steve Wagner <li...@...> wrote:
>>>> I think there is a problem in the implementation of the this
>> "Routes.Products()". Example
>>>> [PatternRoute("Foo", "feed/foo/<id>")
>>>> public void Foo() {}
>>>>
>>>> [PatternRoute("Bar", "feed/bar/<id>")
>>>> public void Bar() {}
>>>>
>>>> If i call now Routes.Foo() or Route.Bar() if always get the same url.
>> This is because the generates generates this:
>>>> public virtual string Foo(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return
>> this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo,
>> new System.Collections.Hashtable(), routeParameters);
>>>> }
>>>>
>>>> public virtual string Bar(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return
>> this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo,
>> new System.Collections.Hashtable(), routeParameters);
>>>> }
>>>>
>>>> And on my perspective this calls are the same. I think this calls must
>> be look like this:
>>>> public virtual string Foo(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>>>
>>>> }
>>>>
>>>> public virtual string Bar(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>>>
>>>> }
>>>>
>>>> I someone can confirm this i will look forward to write a patch for it.
>>>>
>>>> Steve
>>>>
>>>> Lee Henson schrieb:
>>>>
>>>>> I've updated the code generator for use with the latest routing stuff.
>>>>> It's hacked together a bit, and I'm pretty sure I don't quite grasp
>>>>> exactly all the nuances of the routing engine.
>>>>> [StaticRoute("Products", "products")]
>>>>> public void ProductsList()
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Products()
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>>>>> [PatternRoute("Product", "products/<productKey:guid>")]
>>>>> public void Product(Guid productKey)
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Product(new Guid())
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>>>>> [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
>>>>> <zoo>/[beep]", "thing=this")]
>>>>> public void Parp(Guid foo, int bar, string zoo, string beep)
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Lee Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve,

2008/7/25 Steve Wagner <lists@...>:

Hi Lee thanks for doing it! I am too busy at the moment and i could test
it first next week.

I also have a few other things in my head which the generator can be
extend and i list them here. Possibly you find the time and interest to
code them before i get time to do it.

Alas, that looks unlikely. I'm only in this code because I need to add support for rest routes.
 


* RouteDefinitions.AddAll(RoutingEngine engine)

The problem with this is the ordering of the rules. If you wanted them automatically registered you would need to put some sort of index parameter on the route attributes: [PatternRoute(25, "sdfasdf", ....)]. We used to have this, but as soon as you start to get past anything other than a trivial amount of rules, it quickly gets obscure. Better to have all the rules registered in one place where you can see them at one glance.
 

* Add a sample project which demonstrates how to use the generator

* Generate a the needed SiteMapControllerBase into SiteMap.generated.cs
   (The Controller which provides access to Site and Routes)

That forces you to use a specific base class for your controllers. While that may be valid in some scenarios, it is not for all. By adding the appropriate methods/properties yourself, you remain in control of how class hierarchy.
 

* Routes.Foo should return a IRouteActionReference and
IArgumentlessRouteActionReference insted of a string

Reasonable.
 

* Extend IArgumentlessControllerActionReference with "RouteUrl"

Reasonable.
 

By
Steve

Lee Henson schrieb:
> Steve, I just committed a patch for this. Please verify that this has fixed
> your problem.
>
> 2008/7/10 Steve Wagner <lists@...>:
>
>> Ok ive start writing a patch but i could take some time i am really busy
>> at the moment.
>>
>> Steve
>>
>> Lee Henson schrieb:
>>> Hi Steve
>>>
>>> Yeah I see that behaviour too. Did you get around to writing a patch?
>>> I can commit it for you.
>>>
>>> On Jul 4, 4:12 pm, Steve Wagner <li...@...> wrote:
>>>> I think there is a problem in the implementation of the this
>> "Routes.Products()". Example
>>>> [PatternRoute("Foo", "feed/foo/<id>")
>>>> public void Foo() {}
>>>>
>>>> [PatternRoute("Bar", "feed/bar/<id>")
>>>> public void Bar() {}
>>>>
>>>> If i call now Routes.Foo() or Route.Bar() if always get the same url.
>> This is because the generates generates this:
>>>> public virtual string Foo(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return
>> this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo,
>> new System.Collections.Hashtable(), routeParameters);
>>>> }
>>>>
>>>> public virtual string Bar(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return
>> this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo,
>> new System.Collections.Hashtable(), routeParameters);
>>>> }
>>>>
>>>> And on my perspective this calls are the same. I think this calls must
>> be look like this:
>>>> public virtual string Foo(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>>>
>>>> }
>>>>
>>>> public virtual string Bar(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>>>
>>>> }
>>>>
>>>> I someone can confirm this i will look forward to write a patch for it.
>>>>
>>>> Steve
>>>>
>>>> Lee Henson schrieb:
>>>>
>>>>> I've updated the code generator for use with the latest routing stuff.
>>>>> It's hacked together a bit, and I'm pretty sure I don't quite grasp
>>>>> exactly all the nuances of the routing engine.
>>>>> [StaticRoute("Products", "products")]
>>>>> public void ProductsList()
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Products()
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>>>>> [PatternRoute("Product", "products/<productKey:guid>")]
>>>>> public void Product(Guid productKey)
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Product(new Guid())
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>>>>> [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
>>>>> <zoo>/[beep]", "thing=this")]
>>>>> public void Parp(Guid foo, int bar, string zoo, string beep)
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
>
> >
>




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-project-devel@...
To unsubscribe from this group, send email to castle-project-devel-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Contrib Code Generator

by Steve Wagner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Seems to works fine here. Nice work!

Lee Henson schrieb:

> Steve, I just committed a patch for this. Please verify that this has fixed
> your problem.
>
> 2008/7/10 Steve Wagner <lists@...>:
>
>> Ok ive start writing a patch but i could take some time i am really busy
>> at the moment.
>>
>> Steve
>>
>> Lee Henson schrieb:
>>> Hi Steve
>>>
>>> Yeah I see that behaviour too. Did you get around to writing a patch?
>>> I can commit it for you.
>>>
>>> On Jul 4, 4:12 pm, Steve Wagner <li...@...> wrote:
>>>> I think there is a problem in the implementation of the this
>> "Routes.Products()". Example
>>>> [PatternRoute("Foo", "feed/foo/<id>")
>>>> public void Foo() {}
>>>>
>>>> [PatternRoute("Bar", "feed/bar/<id>")
>>>> public void Bar() {}
>>>>
>>>> If i call now Routes.Foo() or Route.Bar() if always get the same url.
>> This is because the generates generates this:
>>>> public virtual string Foo(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return
>> this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo,
>> new System.Collections.Hashtable(), routeParameters);
>>>> }
>>>>
>>>> public virtual string Bar(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return
>> this.engineContext.Services.UrlBuilder.BuildUrl(this.engineContext.UrlInfo,
>> new System.Collections.Hashtable(), routeParameters);
>>>> }
>>>>
>>>> And on my perspective this calls are the same. I think this calls must
>> be look like this:
>>>> public virtual string Foo(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>>>
>>>> }
>>>>
>>>> public virtual string Bar(string id) {
>>>>   System.Collections.IDictionary routeParameters
>> Castle.MonoRail.Framework.Helpers.DictHelper.Create();
>>>>   routeParameters.Add("id", id);
>>>>   return RouteDefinitions.Foo.CreateUrl( routeParameters );
>>>>
>>>> }
>>>>
>>>> I someone can confirm this i will look forward to write a patch for it.
>>>>
>>>> Steve
>>>>
>>>> Lee Henson schrieb:
>>>>
>>>>> I've updated the code generator for use with the latest routing stuff.
>>>>> It's hacked together a bit, and I'm pretty sure I don't quite grasp
>>>>> exactly all the nuances of the routing engine.
>>>>> [StaticRoute("Products", "products")]
>>>>> public void ProductsList()
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Products()
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Products)
>>>>> [PatternRoute("Product", "products/<productKey:guid>")]
>>>>> public void Product(Guid productKey)
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Product(new Guid())
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Product)
>>>>> [PatternRoute("Complex", "<thing:anyof(this|that)/<foo:guid>/<bar:int>/
>>>>> <zoo>/[beep]", "thing=this")]
>>>>> public void Parp(Guid foo, int bar, string zoo, string beep)
>>>>> {
>>>>> }
>>>>> Accessible via: Routes.Complex(fooGuid, intBar, zoo, beep)
>>>>> Set up via: RoutingModuleEx.Engine.Add(RouteDefinitions.Complex)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subs