Skip to content

Stored procedure

Maxim edited this page Nov 14, 2019 · 3 revisions
//Create adapter data access, where OrderContext your DbContext
var dataAdapter = new OeEfCoreDataAdapter<Model.OrderContext>(OrderContextOptions.Create(useRelationalNulls: true));
//Create query parser
var parser = new OeParser(new Uri("http://dummy"), dataAdapter.BuildEdmModel());
//The result of the stored procedure
var response = new MemoryStream();
//Execute sored procedure
await parser.ExecuteGetAsync(new Uri("http://dummy/dbo.GetOrders(name='Order 1',id=1,status=null)"), OeRequestHeaders.JsonDefault, response, CancellationToken.None);

Data context method mapped to stored procedure must decorate DescriptionAttribute contains procedure name. For db function description must ending parenthesis ([Description("dbo.ResetDb()")]).