MySql EF 6存储过程导入功能不支持EDM类型 [英] MySql EF 6 Stored Procedure Import Function EDM Type Not Supported

查看:330
本文介绍了MySql EF 6存储过程导入功能不支持EDM类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用MySQL和Entity Framework,并将存储过程导入到edmx文件中时遇到了一个问题。在下面的图片中,您可以看到EDM类型列列出了我从SP返回的所有列都列为不支持。如果我在窗口中单击Ok,它将生成Complex类型类;但是,类文件将不会有任何属性。



有没有办法解决这个问题?我有google和搜索堆栈溢出相当多。我读过的唯一解决办法是手动生成类文件,也可以手动调用SP,或手动修改edmx文件。



解决方案

似乎是一个问题,如这里所述 http://bugs.mysql.com/bug.php?id=79180 最近一周。 / p>

我正在手动编辑edmx,将属性添加到自动生成的ComplexType,并在自动生成的FunctionImportMapping部分的返回映射中添加ScalarProperties。



在完成这些手动编辑之后,我现在可以使用标准的EF模型调用SP,并且获得所有返回的行和列(下面的示例现在可用于我在那之前手动改变edmx文件,所有我回来的是一个列表中的空对象 - 每行返回一个对象 - 没有数据)

  using( var context = new therinksEntities())
{

ObjectResult< getGLDistSection_Result> rdrs = context.getGLDistSection(AIM,Deferred,2015-07-01,2015-09-30);
int i = 0;
foreach(getGLDistSection_Result result in rdrs)
{

NonBlockingConsole.WriteLine(i ++ +:+
result.glaccount +:+
result.posteddate +:+
result.customername +:+
result.category +:+
result.description +:+
结果。借记+:+
result.credit +:+
result.balance);
}
}

我正在使用VS 2015,包 - EF 6.1 .3,MySql.Data 6.9.8,MySql.Data.Entit 6.9.8
MySql数据库版本MySql 5.5.46-log



它是一个痛苦的解决方法如果需要使用许多SP。但是,通过修改edmx并保存和验证..所有正确的代码与属性一起生成 - 所以不需要创建手册类或其他属性。


I am new to using MySQL and Entity Framework and came across a issue when importing a stored procedure into the edmx file. In the image below you can see that the EDM type column has listed all the columns I'm returning from the SP are listed as "Not Supported". If I go ahead and click Ok in the window it will generate the Complex type class; however, the class file will not have any properties in it.

Is there a way to fix this? I have google and searched stack overflow quite a bit. The only solutions I have read are to manually generate the class files and call the SP manually as well, or to modify the edmx file by hand.

解决方案

Appears to be an issue as noted here http://bugs.mysql.com/bug.php?id=79180 as recently as a week..ago.

I am manually editing the edmx directly to ADD the properties to the ComplexType that was autogenerated, and to ADD the ScalarProperties in the return mapping of the FunctionImportMapping section that was autogenerated..

After doing these manual edits, I can now call my SP using the standard EF model and I get all the rows and columns returned as such (the below example works now for me, where prior to manually changing the edmx file, all I got back were empty Objects in a list - one object per row returned - no data)

        using (var context = new therinksEntities())
        {

            ObjectResult<getGLDistSection_Result> rdrs =  context.getGLDistSection("AIM", "Deferred", "2015-07-01", "2015-09-30");
            int i = 0;
            foreach (getGLDistSection_Result result in rdrs)
            {

                NonBlockingConsole.WriteLine(i++ + ":" +  
                    result.glaccount + ":" +
                    result.posteddate + ":" +
                    result.customername + ":" +
                    result.category + ":" +
                    result.description + ":" +
                    result.debit + ":" +
                    result.credit + ":" +
                    result.balance);
            }
        }

I am using VS 2015, and packages - EF 6.1.3, MySql.Data 6.9.8, MySql.Data.Entit 6.9.8 MySql Database Version MySql 5.5.46-log

Its a painful workaround if many SP's are needed to be used. But, by modifying the edmx and saving and verifying.. all the correct code gets generated along with the properties - so no manual classes or additional properties need to be created.

这篇关于MySql EF 6存储过程导入功能不支持EDM类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆