locked
wcf data svcs 5 and add service reference RRS feed

  • Question

  • When I add a service reference in vs2010 to a WCF Data Services 5 Odata v.3 project, it adds a proxy class that seems to be referencing the System.Data.Services instead of Microsoft.Data.Services.  It adds the reference and I have to remove it each time.  A resource I have says that that WCF 5 installer is supposed to update the "add service reference" system so that it targets correctly.

    I've already tried doing a repair of the WCF 5 installation and the behavior is the same.

    How can I properly generate client proxies against WCF 5 services (most important)?  Secondly, how can I get "add service reference" to do it properly as well.  It is definitely the most convinient tool for me to use.  Below is my metadata:

    <?xml version="1.0" encoding="utf-8"?>
    <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
      <edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
        <Schema Namespace="FeatureTrackerModel" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
          <EntityType Name="Feature">
            <Key>
              <PropertyRef Name="FeatureId" />
            </Key>
            <Property Name="FeatureId" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
            <Property Name="Label" Type="Edm.String" Nullable="false" MaxLength="100" FixedLength="false" Unicode="true" />
            <Property Name="Description" Type="Edm.String" Nullable="false" MaxLength="1000" FixedLength="false" Unicode="true" />
            <Property Name="Complexity" Type="Edm.Int32" Nullable="false" />
            <Property Name="Completion" Type="Edm.Int32" Nullable="false" />
            <Property Name="Version" Type="Edm.Binary" Nullable="false" MaxLength="8" FixedLength="true" p6:StoreGeneratedPattern="Computed" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
          </EntityType>
        </Schema>
        <Schema Namespace="FeatureTracker.Data" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
          <EntityContainer Name="FeatureTrackerEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
            <EntitySet Name="Features" EntityType="FeatureTrackerModel.Feature" />
          </EntityContainer>
        </Schema>
      </edmx:DataServices>
    </edmx:Edmx>

    Also, I can confirm by manual inspection that the datasvcutil out of the wcf 5 folder generates a different cs file than regular service reference generator.  I suppose I'll just do it by hand...

    Thanks,

    -Ethan Nelson



    Tuesday, August 7, 2012 11:32 PM

Answers

  • Here's the link to download the MSI for WCF data services 5.0 : http://www.microsoft.com/en-us/download/details.aspx?id=29306. Please try and install this msi. Also first uninstall the one you have, and then install this one from the above link.

    Also, please make sure in the project that you are targetting 4.0 framework.

    Please let us know if this does not still work for you.

    Thanks

    Pratik


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Ethan Nelson Thursday, August 9, 2012 4:49 PM
    Thursday, August 9, 2012 4:41 PM
    Moderator
  • I've verified my findings.  When a project is targeted at .NET 4.0.3, the version of datasvcutil used by add service reference is the old one.  When I target .NET 4, the new one picks up the job and generates all the appropriate wcf 5 odata 3 code.

    So it does not look like a problem with my installation of the wcf 5 odata 3 msi.  It was just that my projects were targeting .NET 4.0.3 which did not yeild the correct add service reference behavior.

    -Ethan Nelson

    • Marked as answer by Ethan Nelson Thursday, August 9, 2012 4:52 PM
    Thursday, August 9, 2012 4:52 PM

All replies

  • Hi,

    Go through this blog post below. It could be that the data service mark up needs to be changed manually as mentioned below. Apologies if you have tried this already

    http://blogs.msdn.com/b/astoriateam/archive/2009/03/16/ado-net-data-services-v1-5-ctp1-now-available-for-download.aspx

    Wednesday, August 8, 2012 10:05 PM
  • That did not do it.  The MSDN literature for "version" wcf data service 5.0 says that it updates "add service reference" to generate the correct client files.  So that was not necessary.  However, I think the problem may be that I have the .net 4.0.3 targeting pack installed.  It appears that by retargeting my solution to 4.0 it generates the correct Reference.cs file.  I will continue to experiment to hopefully firm up these suspicions.

    -Ethan Nelson

    • Marked as answer by Ethan Nelson Thursday, August 9, 2012 4:49 PM
    • Unmarked as answer by Ethan Nelson Thursday, August 9, 2012 4:52 PM
    Thursday, August 9, 2012 1:36 AM
  • Here's the link to download the MSI for WCF data services 5.0 : http://www.microsoft.com/en-us/download/details.aspx?id=29306. Please try and install this msi. Also first uninstall the one you have, and then install this one from the above link.

    Also, please make sure in the project that you are targetting 4.0 framework.

    Please let us know if this does not still work for you.

    Thanks

    Pratik


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Ethan Nelson Thursday, August 9, 2012 4:49 PM
    Thursday, August 9, 2012 4:41 PM
    Moderator
  • I've verified my findings.  When a project is targeted at .NET 4.0.3, the version of datasvcutil used by add service reference is the old one.  When I target .NET 4, the new one picks up the job and generates all the appropriate wcf 5 odata 3 code.

    So it does not look like a problem with my installation of the wcf 5 odata 3 msi.  It was just that my projects were targeting .NET 4.0.3 which did not yeild the correct add service reference behavior.

    -Ethan Nelson

    • Marked as answer by Ethan Nelson Thursday, August 9, 2012 4:52 PM
    Thursday, August 9, 2012 4:52 PM