I need to complete my task using only stored procedures.
In my app I have Models called \'Document\' and \'DocumentInfo\' which refers to mysql tables. For example I go
For FromSql
, it is used with Query
, you could define a new model for return result.
public class ResultDto
{
public string Name { get; set; }
}
Define Query
in OnModelCreating
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Query();
}
Useage:
var result = _context.Query().FromSql("exec GetDocumentBodyById {0}", 1).ToList();