Using the entity framework with a MySQL DB and the model designer doesn't pickup stored proc parameters

前端 未结 7 1935
梦谈多话
梦谈多话 2021-01-13 08:34

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.

7条回答
  •  没有蜡笔的小新
    2021-01-13 09:15

    Here is a sample of my code got it working with VS2012 and Mysql connector 6.8.3 just generate your datamodel same as usual and dont forget to include the stored procedures.

    Hope this help's someone.

    public static IList GetCustOrderHist(string someParameter)
        {
            IList data = ((IObjectContextAdapter)TestDashboardEntities).ObjectContext.ExecuteStoreQuery("CALL CustOrderHist({0});", someParameter).ToList();
    
            return data;
        }
    
        public class MyClass
        {
            public string ProductName { get; set; }
            public int TOTAL { get; set; }
        }
    

提交回复
热议问题