导入 mysql类型不支持,MySql EF 6存储过程导入功能不支持EDM类型

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.

q3tTA.png

解决方案

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 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值