MySQL实体框架4.0存储过程字段映射

时间:2022-01-19 02:19:33

Has anyone here used MySQL with the entity framework 4.0 and stored procedures? When I add a SP, it does not show any of my fields that I need to input. I also see no way to manually add them. When I click Function Import Mapping, it simply says "Select an Entity or Association on the Entity Designer Model Browser to edit it's mapping".

有没有人在这里使用MySQL与实体框架4.0和存储过程?当我添加SP时,它不会显示我需要输入的任何字段。我也看不到手动添加它们的方法。当我单击“函数导入映射”时,它只是说“在实体设计器模型浏览器上选择一个实体或关联来编辑它的映射”。

Any help is appreciated. I am using the .NET Connector 6.3.6

任何帮助表示赞赏。我使用的是.NET Connector 6.3.6

1 个解决方案

#1


10  

due to the bug #55778 (Stored procedure parameters are omitted during update of the entity data model) it is not possible to automatically import MySQL Stored Procedures into a entity data model.

由于错误#55778(在更新实体数据模型期间省略了存储过程参数),因此无法将MySQL存储过程自动导入实体数据模型。

As a workaround you could manually manipulate the created .edmx file (.ssdl, .csdl):

作为一种解决方法,您可以手动操作创建的.edmx文件(.ssdl,.csdl):

Import the MySQL Stored Procedure as discribed above

导入如上所述的MySQL存储过程

Search for the Stored Procedure name within the model (.edmx file or .ssdl, .csdl files)

在模型中搜索存储过程名称(.edmx文件或.ssdl,.csdl文件)

Within the Storage Model (SSDL) replace:

在存储模型(SSDL)中替换:

  <Function Name="GetStudentGrades" Aggregate="false" BuiltIn="false"
            NiladicFunction="false" IsComposable="false"
            ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
  </Function>

with:

有:

  <Function Name="GetStudentGrades" Aggregate="false" BuiltIn="false"
           NiladicFunction="false" IsComposable="false"
            ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
    <Parameter Name="StudentID" Type="int" Mode="In" />
  </Function>

Within the Conceptual Model (CSDL) replace:

在概念模型(CSDL)中替换:

  <FunctionImport Name="GetStudentGrades" EntitySet="StudentGrades" ReturnType=...>
  </FunctionImport>

with:

有:

  <FunctionImport Name="GetStudentGrades" EntitySet="StudentGrades" ReturnType=...>
    <Parameter Name="StudentID" Mode="In" Type="Int32" />
  </FunctionImport>

Hope that helps! Cheers

希望有所帮助!干杯

#1


10  

due to the bug #55778 (Stored procedure parameters are omitted during update of the entity data model) it is not possible to automatically import MySQL Stored Procedures into a entity data model.

由于错误#55778(在更新实体数据模型期间省略了存储过程参数),因此无法将MySQL存储过程自动导入实体数据模型。

As a workaround you could manually manipulate the created .edmx file (.ssdl, .csdl):

作为一种解决方法,您可以手动操作创建的.edmx文件(.ssdl,.csdl):

Import the MySQL Stored Procedure as discribed above

导入如上所述的MySQL存储过程

Search for the Stored Procedure name within the model (.edmx file or .ssdl, .csdl files)

在模型中搜索存储过程名称(.edmx文件或.ssdl,.csdl文件)

Within the Storage Model (SSDL) replace:

在存储模型(SSDL)中替换:

  <Function Name="GetStudentGrades" Aggregate="false" BuiltIn="false"
            NiladicFunction="false" IsComposable="false"
            ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
  </Function>

with:

有:

  <Function Name="GetStudentGrades" Aggregate="false" BuiltIn="false"
           NiladicFunction="false" IsComposable="false"
            ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
    <Parameter Name="StudentID" Type="int" Mode="In" />
  </Function>

Within the Conceptual Model (CSDL) replace:

在概念模型(CSDL)中替换:

  <FunctionImport Name="GetStudentGrades" EntitySet="StudentGrades" ReturnType=...>
  </FunctionImport>

with:

有:

  <FunctionImport Name="GetStudentGrades" EntitySet="StudentGrades" ReturnType=...>
    <Parameter Name="StudentID" Mode="In" Type="Int32" />
  </FunctionImport>

Hope that helps! Cheers

希望有所帮助!干杯