Re: [fubumvc] Set route parameter value in input type during route creation

42 views
Skip to first unread message

Joshua Arnold

unread,
Sep 1, 2012, 4:25:46 PM9/1/12
to fubumv...@googlegroups.com
@David,

I'm trying to follow what you're doing here but I'm exactly sure why you're attempting this. What's the significance of the EntityName property on your input type?


On Sat, Sep 1, 2012 at 3:08 PM, David Roberts <david.r...@gmail.com> wrote:
What are some recommended ways to define an input parameter but set its value during route creation? For example:

Given my route pattern looks like "/Customers/{Id}/Edit"
 And my input type has two properties (Id and EntityName)
When a request is made with "/Customers/1/Edit"
Then the input type is set as such:
   Id = 1
   Entityname = "Customers"

The '/Edit' is linked to the input type itself. I'm not looking for a dynamic 'EntityName' input value. I want to determine what entity name during IUrlPolicy.Build is valid from the ActionCall and then setup a distinct route.

I am currently trying a pattern with a default value:
"/{EntityName:Customers}/{Id}/Edit"
And am in the middle of adding an exact match route constraint for "EntityName" to see if that setup works. Are there other ways to do this?

--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/fubumvc-devel/-/WrkUh97ADE4J.
To post to this group, send email to fubumv...@googlegroups.com.
To unsubscribe from this group, send email to fubumvc-deve...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.

Mike O'Brien

unread,
Sep 1, 2012, 4:40:04 PM9/1/12
to fubumv...@googlegroups.com
Looks like your trying to dynamically build up routes based on entities in your domain a la:

/Customers/...
/Accounts/...
/Addresses/...
...

Is this right?

Joshua Arnold

unread,
Sep 1, 2012, 4:40:59 PM9/1/12
to fubumv...@googlegroups.com
If that's the case, then I would recommend change your actioncall to use an open type (e.g., EditEntity<TEntity>) rather than take the entity type through the route.

David Roberts

unread,
Sep 1, 2012, 5:22:42 PM9/1/12
to fubumv...@googlegroups.com
Well, i was hoping to reply here before anyone else did, everyone is quick to respond! :-) This thread can be disregarded.

Stepping away and running around as Superman with my son cleared my mind a bit.

hcoverlambda is correct in what I am attempting to do (regarding the EntityName) and the dynamic nature does seem to fit more than I originally thought. In the end what I'm going to do is to create a single ActionCall for my 'EditEntity()' with the input Id and EntityName being filled by URL route parameters with an EntityName route constraint of a predetermined list of entity type names.

I have used an open type setup before and really like the style. But in this case I'm try out something with the C# 4 'dynamic' keyword and so static types will not be available.

Again, thanks for the very quick responses everyone. 

Mike O'Brien

unread,
Sep 1, 2012, 6:16:51 PM9/1/12
to fubumv...@googlegroups.com
Another approach you can look at is creating an action source that scans for entities and generates routes. @rauhryan did something along those lines here:


A coworker has been experimenting with this idea as well and it looks promising.

--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/fubumvc-devel/-/_mPnmM3beL8J.

Dru Sellers

unread,
Sep 1, 2012, 7:12:21 PM9/1/12
to fubumv...@googlegroups.com
ActionSources are the bomb. 
That is all

-d
Reply all
Reply to author
Forward
0 new messages