c# - WebAPI: How can I make sure a controller will implement POST? -


i working on webapi service want create different types of controllers. if controller should implememt post method, want have interface ipostcontroller enforces it. however, if controller method needs take [frombody] attribute of specific type? how should interface [frombody] methods?

i did create method in interface looking this, idea enforces implementation object type parameter makes me sceptical.

ihttpactionresult post([frombody] object item); 

this forces implementation looks following line:

public ihttpactionresult post([frombody]object item){ ... } 

if change object class want use, not implement interface method anymore.

any ideas on should best practice here?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -