小编sma*_*o81的帖子

WebAPI 2 OData - '〜/ entityset/key/$ links/navigation'没有路由约定

我是OData和WebAPI的新手2.很抱歉提前.

我的目标是使用OData服务,该服务具有公开的WcfService对象和WcfClient对象,并通过list属性将WcfClient其关联.(例如,但使用OData服务)WcfServiceClientsservice.Clients.Add(client)

我有一个EF代码第一个数据库WcfService,WcfClientSoaApplication类别.并且,使用Microsoft.AspNet.WebApi.OData 5.1.1进行OData Web服务设置.连接所有内容的代码都是使用VS2013中的向导设置的.OData端点的$ metadata类似于this(http://soa.local.xxx/odata/$metadata):

<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
  <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="3.0" m:MaxDataServiceVersion="3.0">
    <Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" Namespace="xxx">
      <EntityType Name="SoaApplication">
        <Key>
          <PropertyRef Name="ApplicationId"/>
        </Key>
        <Property Name="ApplicationId" Type="Edm.Int32" Nullable="false"/>
        <Property Name="ComputerName" Type="Edm.String"/>
        <Property Name="ConfigLocation" Type="Edm.String"/>
      </EntityType>
      <EntityType Name="WcfClient">
        <Key>
          <PropertyRef Name="ClientId"/>
        </Key>
        <Property Name="ClientId" Type="Edm.Int32" Nullable="false"/>
        <Property Name="ApplicationId" Type="Edm.Int32" Nullable="false"/>
        <Property Name="Address" Type="Edm.String"/>
        <Property Name="Binding" Type="Edm.String"/>
        <Property Name="BindingConfiguration" Type="Edm.String"/>
        <Property Name="Contract" Type="Edm.String"/>
        <NavigationProperty Name="Application" Relationship="xxx.xxx_WcfClient_Application_xxx_SoaApplication_ApplicationPartner" ToRole="Application" …
Run Code Online (Sandbox Code Playgroud)

c# asp.net wcf web-services asp.net-web-api

5
推荐指数
1
解决办法
7437
查看次数

MSBuild错误:元素<ProjectReference>中的属性"删除"无法识别

我正在尝试将.csproj文件设置为具有条件项组,该组将删除<ProjectReference>项组中的所有元素.

例如:

<ItemGroup>
   <ProjectReference Include="..\..\..\..\Projects\Registrar\Ucsb.Sa.Registrar.Common\Ucsb.Sa.Registrar.Common\Ucsb.Sa.Registrar.Common.csproj">
      <Project>{1EDDDE57-0181-41B4-B2AE-FB76450F85C8}</Project>
      <Name>Ucsb.Sa.Registrar.Common</Name>
   </ProjectReference>
</ItemGroup>
<ItemGroup Condition="$(OnBuildServer) == 'true'">
   <ProjectReference Remove="*" />
</ItemGroup>
<ItemGroup Condition="$(OnBuildServer) == 'true'">
   <Reference Include="Ucsb.Sa.Registrar.Common">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(RegCommonDll)</HintPath>
   </Reference>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)

但是,当我将项目加载到VS 2008时,我收到错误消息'属性'删除元素<ProjectReference>中的"无法识别".奇怪的是删除属性在架构中(C:\ Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\1033\MSBuild\Microsoft.Build.Core.xsd).上面有MSDN文档(http://msdn.microsoft.com/en-us/library/bb651786.aspx).并且,在MSDN文章"MSBuild Items"的底部有一个关于它的评论.

.csproj文件似乎指向.NET 3.5; 但我无法验证是否正在使用该版本的msbuild加载项目(有人知道该怎么做吗?)

.csproj文件的第一行:

<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Run Code Online (Sandbox Code Playgroud)

PS.我有了使用Build with msbuild的条件并动态设置项目引用的想法

.net msbuild visual-studio-2008 visual-studio

2
推荐指数
1
解决办法
1万
查看次数