I have DB in MySQL, using common mysql entity framework end up with errors, so I switched to pomelo.entityframeworkcore.mysql.
In my MySQL Db I have few stored procedures. But I do not undertand how to comunicate with it. Usual mysql queries runs perfectly and works fine just like that:
public void ONELINE_SQL_TEST()
{
var db = new DBContext();
var test = db.DocumentsInfo.FromSql("SELECT * FROM `DocumentsInfo` LIMIT 0, 2").ToList();
}
DocumentsInfo is my Model class / one of my mysql table.
But I can't call my stored procedures, keep receiving errors:
USE `testProj`$$
CREATE PROCEDURE `GetDocumentsByName` (DocName varchar(255))
BEGIN
Select * from AllDocuments where DocumentName like DocName;
END$$
DELIMITER ;
and code i've tried:
var docs1 = db.DocumentsInfo.FromSql("GetDocumentByName @DocName = {0}", Filename).ToList(); //not working
var docs2 = db.DocumentsInfo.FromSql("GetDocumentByName @p0", Filename).ToList(); //not working
error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GetDocumentByName 'nameAZ'' at line 1'
