| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Simplify.Web.Json is a package which provides JSON serialization/deserialization for Simplify.Web web-framework controllers using Newtonsoft.Json.
If the controller returns Json response class object, then the Framework execution will be stopped, object will be parsed to JSON string and sent to client
public class MyController : Controller2
{
public ControllerResponse Invoke()
{
...
return new Json(myObj);
}
}public void Configuration(IApplicationBuilder app)
{
...
HttpModelHandler.RegisterModelBinder<JsonModelBinder>();
app.UseSimplifyWeb();
}
public void ConfigureServices(IServiceCollection services)
{
...
HttpModelHandler.ModelBindersTypes.Clear(); // This is required to remove built-in JSON model binder (based on System.Text.Json)
DIContainer.Current.RegisterJsonModelBinder();
...
}public class MyController : Controller2<MyModel>
{
public async Task<ControllerResponse> Invoke()
{
await ReadModelAsync();
Model.
}
}JSON string will be deserialized to the controller model on first model access
public class MyController : Controller2<MyModel>
{
public ControllerResponse Invoke()
{
Model.
}
}There are many ways in which you can participate in the project. Like most open-source software projects, contributing code is just one of many outlets where you can help improve. Some of the things that you could help out with are:
Additional extensions to Simplify.Web live in their own repositories on GitHub. For example:
Licensed under the GNU Lesser General Public License
| Back | FazBrowse Home | New Git URL |