Code Monkey home page Code Monkey logo

Comments (5)

mccalltd avatar mccalltd commented on August 16, 2024

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.

mdmoura avatar mdmoura commented on August 16, 2024

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.

mccalltd avatar mccalltd commented on August 16, 2024

I write some tests and figure this out.

from attributerouting.

mccalltd avatar mccalltd commented on August 16, 2024

Just pass an integer. This works. I just wrote the test and pushed into master.

from attributerouting.

mdmoura avatar mdmoura commented on August 16, 2024

Thanks!

from attributerouting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.