Post
by df5 » Fri 22 Jun 2018 16:53
Is this possible in EF Core? I'm using the insider build Devart Oracle EF version 9.5.527 and I am not having any success.
I get an error of "A second operation started on this context before a previous operation completed." error when this LINQ statement is issued:
using (var db = new ScheduleContext())
{
var query = (from s in db.Schedules
where s.OPR_DATE == System.DateTime.Now.Date &&
db.IsAuthorizedFunction("SomeUserAccount", s.FORNAME, s.WITHNAME, s.SENDERNAME, s.RECEIVERNAME, s.OPR_DATE) == 1
select s).ToList();
}
The DbContext IsAuthorizedFunction is defined like this:
public int IsAuthorizedFunction(string userAccount, string forCompanySN, string withCompanySN, string senderCompanySN, string receiverCompanySN, DateTime oprDate)
{
OracleParameter pReturn = new OracleParameter("pReturn", OracleDbType.Number, ParameterDirection.ReturnValue);
var isAuthd = this.Database.ExecuteSqlCommand("begin :pReturn := pkgSecurity.Is_Authorized(:p0 ,:p1, :p2, :p3, :p4, :p5); end;",
pReturn, userAccount, forCompanySN, withCompanySN, senderCompanySN, receiverCompanySN, oprDate);
return Convert.ToInt16(pReturn.Value);
}