Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
MVC Query String Parameters
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
scott  
View profile  
 More options May 6 2012, 8:12 am
From: scott <pfaff.sc...@gmail.com>
Date: Sun, 6 May 2012 05:12:56 -0700 (PDT)
Local: Sun, May 6 2012 8:12 am
Subject: MVC Query String Parameters
I have read several posts on this forum regarding RavenDB and it's
default style of document ID's i.e. "Countries/1" and how they
conflict with embedded query string parameters in a URL.

There have been several solutions offered for this problem and maybe I
missed the following solution or maybe it's frowned upon, but I would
like your opinions.

I was testing various ways to pass the ID of a document and used the
traditional form of a named parameter with Url.Encode() and was able
to pass the ID with very little effort and it was decoded with no
extra work on my part in the controller action.

Is this an acceptable practice or are there some hidden issues that I
am unaware of?

Thanks
Scott


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Itamar Syn-Hershko  
View profile  
 More options May 6 2012, 8:18 am
From: Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
Date: Sun, 6 May 2012 15:18:36 +0300
Local: Sun, May 6 2012 8:18 am
Subject: Re: [RavenDB] MVC Query String Parameters

What controller action are we talking about? Basically you want to keep
most of them, at least the more common, human readable, and encoding
doesn't really help

See the "Routes" section in
http://ravendb.net/kb/3/using-ravendb-in-an-asp-net-mvc-website


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felipe Leusin  
View profile  
 More options May 6 2012, 8:27 am
From: Felipe Leusin <felipe.leu...@gmail.com>
Date: Sun, 6 May 2012 05:27:36 -0700 (PDT)
Local: Sun, May 6 2012 8:27 am
Subject: Re: [RavenDB] MVC Query String Parameters

The ToIntId() extension method is your friend:

public static int ToIntId(this string id)
                {
                        return int.Parse(id.Substring(id.LastIndexOf('/') + 1));
                }

                public static long ToLongId(this string id)
                {
                        return long.Parse(id.Substring(id.LastIndexOf('/') + 1));
                }

This serves me well in a a lot of cases. Just use it when you're passing
values to your ViewModel and use the int/long in your ViewModel.

Em domingo, 6 de maio de 2012 09h18min36s UTC-3, Itamar Syn-Hershko
escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
scott  
View profile  
 More options May 6 2012, 4:42 pm
From: scott <pfaff.sc...@gmail.com>
Date: Sun, 6 May 2012 13:42:45 -0700 (PDT)
Local: Sun, May 6 2012 4:42 pm
Subject: Re: MVC Query String Parameters
Thanks for the quick replies!

I hadn't thought of having a string ID on the domain model and an int
ID on the viewmodel but that makes perfect sense.

I can just use AutoMapper to map back and forth between the two models
using an IValueResolver class.

I have just started testing different scenarios with RavenDB but it's
been a lot of fun learning a NEW way to work with classes and
persisting data.

A big thanks to the RavenDB crew!

Scott

On May 6, 8:27 am, Felipe Leusin <felipe.leu...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »