Alex Rivera | Logout

RavenDb with ASP.NET MVC 3 - How to generate URL with ID?

Asked 2011-09-09T11:18:00.397
11

This is probably a very simple answer, but i'm new to RavenDb, so i'm obviously missing something.

I've got a basic object with the default convention for id:

public string Id { get; set; }

When i save it to the document store, i see it gets a value of like:

posts/123

Which is fine, but...how do i generate a URL like this:

www.mysite.com/edit/123

If i do this:

@Html.ActionLink("Edit", "Posts", new { id = @Model.Id })

It will generate the followiung URL:

www.mysite.com/edit/posts/123

Which is not what i want.

Surely i don't have to do string manipulation? How do people approach this?

Edit
Report

1 Answer

3

You can simply use ...

int Id;

..instead of ...

string Id;

in your entity classes :)

answered 2012-02-26T20:09:35.403

Your Answer