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:
- Documentation (both code and features)
- Bug reports
- Bug fixes
- Feature requests
- Feature implementations
- Test coverage
- Code quality
- Sample applications
Additional extensions to Simplify.Web live in their own repositories on GitHub. For example:
- Simplify.Web.Postman - Postman collection and environment generation
- Simplify.Web.Swagger - Swagger generation for controllers
- Simplify.Web.Multipart - multipart form model binder
- Simplify.Web.MessageBox - non-interactive server side message box
- Simplify.Web.Templates - .NET projects templates
Licensed under the GNU Lesser General Public License