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

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -