I've got the latest Mysql connector that allows you to use the Visual Studio Entity Framework designer. It's been working great, but I just added a stored proc.
The Server Explorer loaded it up fine with the parameters specified, but then I added it to the Entity Model & the code it generates doesn't have any input parameters.
Here's the stored procedure
CREATE PROCEDURE `GetViewableMenuNodes`(IN siteId INT, IN parentId INT, IN userName varchar(255))
BEGIN
    select m.*
    from menunode m 
    where m.siteid = siteId
    and m.showinmenu = 1
    and m.parentid = parentId
    and m.viewername = userName;
END
and this is the code generated by the model
public global::System.Data.Objects.ObjectResult<MenuNode> GetViewableMenuNodes()
{
    return base.ExecuteFunction<MenuNode>("GetViewableMenuNodes");
}
                MySQL Connector/NET is compatible with multiple versions of Entity Framework Core. For specific compatibility information, see Table 7.2, “Connector/NET Versions and Entity Framework Core Support”.
You can use stored procedures either to get the data or to add/update/delete the records for one or multiple database tables. EF API creates a function instead of an entity in EDM for each stored procedure and User-Defined Function (UDF) in the target database.
In case you find this helpful, here is the approach I use for working with stored procedures with parameters in MySQL from the MySQL Connector/.NET Entity Framework provider. I call ExecuteStoreQuery(). This liberates me from having to deal with the challenges of mapping procedures with parameters in the model. This works for our needs.
    public IList<SearchResultsMember> SearchMembers(int memberID, string countryCode, string regionCode, string cityCode, float distanceKm,
        int genderID, int ageMin, int ageMax, int offsetRowIndex, int maxRows)
    {
        MySqlParameter[] queryParams = new MySqlParameter[] { 
                                        new MySqlParameter("memberIDParam", memberID),
                                        new MySqlParameter("countryCodeParam", countryCode),
                                        new MySqlParameter("regionCodeParam", regionCode),
                                        new MySqlParameter("cityCodeParam", cityCode),
                                        new MySqlParameter("distanceKmParam", distanceKm),
                                        new MySqlParameter("genderIDParam", genderID),
                                        new MySqlParameter("ageMinParam", ageMin),
                                        new MySqlParameter("ageMaxParam", ageMax),
                                        new MySqlParameter("offsetRowIndexParam", offsetRowIndex),
                                        new MySqlParameter("maxRowsParam", maxRows)
                                    };
        StringBuilder sb = new StringBuilder();
        sb.Append("CALL search_members(@memberIDParam, @countryCodeParam, @regionCodeParam, @cityCodeParam, @distanceKmParam, @genderIDParam, @ageMinParam, @ageMaxParam, @offsetRowIndexParam, @maxRowsParam)");
        string commandText = sb.ToString();
        var results = _context.ExecuteStoreQuery<SearchResultsMember>(commandText, queryParams);
        return results.ToList();
    }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With