none
Edmgen doesn't generate proper outputs. RRS feed

  • Question

  • Hello,

    My OData service is quite different from normal Entity Framework Provider.

    I automatically generate SSDL file, and I pass the file to Edmgen to have it generate other files (CSL, MSL, Data Source and Views) by typing the below command.

    Edmgen.exe /mode:FromSSDLGeneration /inssdl:DatawarehouseModel.ssdl /outcsdl:DatawarehouseModel.csdl /outmsl:DatawarehouseModel.msl /outobjectlayer:DatawarehouseModel.cs /outviews:DatawarehouseModel.Views.cs /namespace:DatawarehouseModel /entitycontainer:DatawarehouseEntities /language:CSharp /targetversion:4.5

    It worked well before adding <Function> tags. I expected Edmgen to generate proper code, but it's not.

    Instead of generating code related to service operations, Edmgen just ignores <function> tags.

    Do you have any ideas about that?

    Thursday, November 29, 2012 4:10 PM

All replies

  • Hi ByHesed,

    Welcome to the MSDN forum.

    Could you please show me the code snippet about function part you added?

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us

    Monday, December 3, 2012 2:37 AM
  • Hi Alexander,

    The below code is SSDL file my program generated.

    Please see the last part written in bold strokes.

    <?xml version="1.0" encoding="utf-8"?>
    <Schema Namespace="DatawarehouseModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
    <EntityContainer Name="DatawarehouseModelStoreContainer">
    <EntitySet Name="OData_Dataset_PATS_IPC" EntityType="DatawarehouseModel.Store.OData_Dataset_PATS_IPC" store:Type="Views" store:Schema="dbo" store:Name="OData_Dataset_PATS_IPC">
    <DefiningQuery>SELECT
          [OData_Dataset_PATS_IPC].[Country] AS [Country],
          [OData_Dataset_PATS_IPC].[Patent] AS [Patent],
          [OData_Dataset_PATS_IPC].[IPC] AS [IPC],
          [OData_Dataset_PATS_IPC].[ReferenceCountry] AS [ReferenceCountry],
          [OData_Dataset_PATS_IPC].[ReferenceDate] AS [ReferenceDate],
          [OData_Dataset_PATS_IPC].[Time] AS [Time],
          [OData_Dataset_PATS_IPC].[Value] AS [Value],
          [OData_Dataset_PATS_IPC].[Flags] AS [Flags],
          [OData_Dataset_PATS_IPC].[IDMetadata] AS [IDMetadata]
          FROM [dbo].[OData_Dataset_PATS_IPC] AS [OData_Dataset_PATS_IPC]</DefiningQuery>
    </EntitySet>
    <EntitySet Name="OData_Dataset_SSIS_BSC" EntityType="DatawarehouseModel.Store.OData_Dataset_SSIS_BSC" store:Type="Views" store:Schema="dbo" store:Name="OData_Dataset_SSIS_BSC">
    <DefiningQuery>SELECT
          [OData_Dataset_SSIS_BSC].[Country] AS [Country],
          [OData_Dataset_SSIS_BSC].[Patent] AS [Patent],
          [OData_Dataset_SSIS_BSC].[IPC] AS [IPC],
          [OData_Dataset_SSIS_BSC].[ReferenceCountry] AS [ReferenceCountry],
          [OData_Dataset_SSIS_BSC].[ReferenceDate] AS [ReferenceDate],
          [OData_Dataset_SSIS_BSC].[Time] AS [Time],
          [OData_Dataset_SSIS_BSC].[Value] AS [Value],
          [OData_Dataset_SSIS_BSC].[Flags] AS [Flags]
          FROM [dbo].[OData_Dataset_SSIS_BSC] AS [OData_Dataset_SSIS_BSC]</DefiningQuery>
    </EntitySet>
    </EntityContainer>

    <EntityType Name="OData_Dataset_PATS_IPC">
    <Key>
    <PropertyRef Name="Country" />
    <PropertyRef Name="Patent" />
    <PropertyRef Name="IPC" />
    <PropertyRef Name="ReferenceCountry" />
    <PropertyRef Name="ReferenceDate" />
    <PropertyRef Name="Time" />
    </Key>
    <Property Name="Country" Type="varchar" Nullable="false" />
    <Property Name="Patent" Type="varchar" Nullable="false" />
    <Property Name="IPC" Type="varchar" Nullable="false" />
    <Property Name="ReferenceCountry" Type="varchar" Nullable="false" />
    <Property Name="ReferenceDate" Type="varchar" Nullable="false" />
    <Property Name="Time" Type="varchar" Nullable="false" />
    <Property Name="Value" Type="float" Nullable="true" />
    <Property Name="Flags" Type="varchar" Nullable="true" />
    <Property Name="IDMetadata" Type="int" Nullable="true" />
    </EntityType>
    <EntityType Name="OData_Dataset_SSIS_BSC">
    <Key>
    <PropertyRef Name="Country" />
    <PropertyRef Name="Patent" />
    <PropertyRef Name="IPC" />
    <PropertyRef Name="ReferenceCountry" />
    <PropertyRef Name="ReferenceDate" />
    <PropertyRef Name="Time" />
    </Key>
    <Property Name="Country" Type="varchar" Nullable="false" />
    <Property Name="Patent" Type="varchar" Nullable="false" />
    <Property Name="IPC" Type="varchar" Nullable="false" />
    <Property Name="ReferenceCountry" Type="varchar" Nullable="false" />
    <Property Name="ReferenceDate" Type="varchar" Nullable="false" />
    <Property Name="Time" Type="varchar" Nullable="false" />
    <Property Name="Value" Type="float" Nullable="true" />
    <Property Name="Flags" Type="varchar" Nullable="true" />
    </EntityType>
    <Function Name="proc_OData_GetDatasetStructure" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
    <Parameter Name="datasetCode" Type="varchar" Mode="In" />
    </Function>
    </Schema>

    As you see, I added Function tags to expose a service operation,

    but when I try to generate other codes from SSDL file by using Edmgen's FromSSDLGeneration mode, Edmgen just ignores Function parts.

    I googled about this issue, and I concluded that Edmgen.exe is unable to import any service operations.

    To tell the truth, it doesn't make sense to me because when I use a wizard in Visual Studio, I can get service operation code automatically.

    I currently adopted a stopgap measure, but I really want to make it beautiful by fully automating the whole process.

    Do you have any ideas about it?

    Thanks.

    Monday, December 3, 2012 9:18 AM
  • Hi ByHesed,

    I tested your problem on my side. The result is the same as you mentioned. In my humble opinion, only with the information in ssdl, it is hard to generate the function mapping information in csdl and msl. Since I have not found an official document about this, for my personal opinion, I think edmgen does not generate the function information for csdl and msl. Could you please check if you can call the function in this way:

    [EdmFunction("DatawarehouseModel.Store", "proc_OData_GetDatasetStructure")] public IQueryable<DbDataRecord> CallFunction() { return this.CreateQuery<DbDataRecord>(@"[DatawarehouseModel.Store].[proc_OData_GetDatasetStructure](@datasetCode)", new ObjectParameter("datasetCode", "abcd"));

    }

    This stub will usually reside within your strongly typed ObjectContext class. 

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



    Wednesday, December 5, 2012 3:16 PM