I have created an application using Serenity framework. I have completed basic functionality for CRUD using serenity. Based on my tables I need to have graphical representations, any charts like high charts, D3 charts or any . 1. How can I get data from the tables using serenity framework ? 2. How can I customise the data into graphical representations ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Finally I have found the answer for this. We can use sql queries as well as stored procedure to fetch data from DB. I have used stored procedure to get the data from db.
In repository page you can call stored procedure,
public ListResponse<MyRow> GetCustomData(IDbConnection connection)
{
var data = connection.Query<MyRow>("GetOrders",
param: new
{
startDate = request.nstartDate,
endDate = request.EndDate
},
commandType: System.Data.CommandType.StoredProcedure);
var response = new ListResponse<MyRow>();
response.Entities = (List<MyRow>)data;
return response;
}
I have already defined MyRow as OrderRow like this using MyRow = Entities.OrderRow;.
You can call this method from your controller. You can pass the value to model and can use data for chart lik highcharts or d3 charts.
Hope this will help you.