i have an entity-model file (edmx) file which contains few tables and few stored procedures.
how can i call those stored procedures that are mapped to functions? i thought it should be trivial, and i do see the mapping in the edmx file, but i can’t figure how to use it in the code.
here is one mapping example:
<Function Name="pa_crud_broker_ADD" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
<Parameter Name="BrokerId" Type="int" Mode="InOut" />
<Parameter Name="Name" Type="nvarchar" Mode="In" />
<Parameter Name="Identifier" Type="nvarchar" Mode="In" />
</Function>
<FunctionImport Name="pa_crud_broker_ADD" ReturnType="Collection(Int32)">
<Parameter Name="BrokerId" Mode="InOut" Type="Int32" />
<Parameter Name="Name" Mode="In" Type="String" />
<Parameter Name="Identifier" Mode="In" Type="String" /></FunctionImport>
<FunctionImportMapping FunctionImportName="pa_crud_broker_ADD" FunctionName="PAEntities.store.pa_crud_broker_ADD" />
i would appreciate any help.
Thanks.
I am a little rusty, however you should be able to call your function in one of two ways. If you are generating an ObjectContext from your model, then you should have a method on your object context that matches the name of your Function (in your case, pa_crud_broker_ADD). You should be able to call it like so:
If you are not generating an ObjectContext from your model, then you should be able to use the following:
I am not entirely certain about the return result in the second case. I am not sure if EF v1 supports such a transformation or not. I know that EF v4 adds some considerable improvements in this area, so if EF v1 does not support it, I would look into EF v4.