MySql EF 6存储过程导入功能不支持EDM类型 [英] MySql EF 6 Stored Procedure Import Function EDM Type Not Supported
问题描述
有没有办法解决这个问题?我有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屋!