Comments (5)
Pass null for each param into the action expression.
On Feb 13, 2012, at 2:26 PM, shapper
[email protected]
wrote:
Hello,
I have the following action:
[GET("Users")]
public virtual ActionResult Index(Int32 p = 1) {
}When I add a translation I get the following:
AddTranslations().ForController()
.RouteUrl(x => x.Index(), new Dictionary<String, String> {
{ "pt", "Utilizadores" }
});I get the following error:
An expression tree may not contain a call or invocation that uses optional arguments
Any idea how to solve this?
Thank You,
Miguel
Reply to this email directly or view it on GitHub:
#47
from attributerouting.
Yes, I tried that before but I get:
Argument 1: cannot convert from '' to 'int'
Unless I change my action to:
public virtual ActionResult Index(Int32? p = 1)
But I would prefer my route to always have a default value, e.g. 1, when no value is provided.
from attributerouting.
I write some tests and figure this out.
from attributerouting.
Just pass an integer. This works. I just wrote the test and pushed into master.
from attributerouting.
Thanks!
from attributerouting.
Related Issues (20)
- Routes seemingly disappear on .NET 4.5.1 with default configuration
- Controller level attributes not being applied when using configuration.AddRoutesFromAssembly
- Same route with different Http Verbs does not work HOT 1
- Routes are not registering HOT 1
- Attribute Routing does not work after deloyment
- how to store subdomain each RouteValues?
- Bug: Route Name + Translation Key = Duplicate Keys
- MVC 5 incorporated? HOT 4
- Need help configuring subdomain area
- Integration with WebApi2?
- Route For Sitemap.xml Not Working in Production
- Poor handling of malformed route - Index was outside the bounds of the array.
- Unhelpful exception
- Custom Translator HOT 1
- Custom Route Translation and UiCulture Constraint
- Doesn't work with New Relic installed on server
- "vjscor" Missing
- "Site disabled · GitHub Pages" when loading attributerouting.net HOT 4
- Nuget.org missing most recent versions HOT 1
- Got System.NullReferenceException on routes.MapHttpAttributeRoutes(); HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from attributerouting.