Coder Social home page Coder Social logo

Comments (4)

alexyakunin avatar alexyakunin commented on May 2, 2024

Hi, it works exactly as you "prescribe" in RestEase client interface plus controller. Here is how you switch one of parameters to body payload:

image
image

Besides that, ICollection<T> should work as [ComputeMethod] parameter by default, but I am not sure if ASP.NET Core will bind such a parameter properly.

I highly recommend you to switch to simply an array or List<T> there - IMO using an interface like IEnumerable<T> is actually a bad practice. The reason is: every user of such a type expects a precise behavior of such a collection - i.e. no lazy loading on enumeration, etc., but when you specify a generic interface there, you sort of imply that API is open for such implementations. Even though in reality it doesn't - and this is true in almost any place like this.

In short, avoid using IEnumerable<T> and other similar interfaces in POCO & model objects. Just use exact types.

from stl.fusion.

alexyakunin avatar alexyakunin commented on May 2, 2024

@devedse hopefully this helps :)

from stl.fusion.

devedse avatar devedse commented on May 2, 2024

Hey @alexyakunin , I added [Body] to the clients and this solved my problem. Thanks for the tips around the IEnumerable for now I just want to make things work as easy as possible but I'll look into this later.

It seems the [FromBody] isn't required in the controller. I suppose post methods automatically accept this.

from stl.fusion.

alexyakunin avatar alexyakunin commented on May 2, 2024

On [FromBody] - maybe it works this way for some param types - I'd rather be explicit about that though...

Anyway, great it's resolved 👍

from stl.fusion.

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.