Entity framework EF6 WCF数据服务公开了单数实体类型名称,而不是复数DbSet属性名称
我是EF的新手。我已经在ASP.NET web应用程序中创建了ODataV3 WCF数据服务。我的DataContext类将我的实体集定义为DbSet类型的属性,其中TEntity是我的实体POCO。属性的名称为复数,我的实体类为单数 现在是奇怪的部分。当我尝试使用url(如)访问实体集时,我得到以下结果:Entity framework EF6 WCF数据服务公开了单数实体类型名称,而不是复数DbSet属性名称,entity-framework,odata,entity-framework-6,wcf-data-services,Entity Framework,Odata,Entity Framework 6,Wcf Data Services,我是EF的新手。我已经在ASP.NET web应用程序中创建了ODataV3 WCF数据服务。我的DataContext类将我的实体集定义为DbSet类型的属性,其中TEntity是我的实体POCO。属性的名称为复数,我的实体类为单数 现在是奇怪的部分。当我尝试使用url(如)访问实体集时,我得到以下结果: <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:c
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code />
<m:message xml:lang="en-US">Resource not found for the segment 'Widgets'.</m:message>
</m:error>
我如何使OData服务使用数据上下文的复数属性名,而不是公开它从I-don-now-where获得的单数实体集名?applicationada.svc的输出显示了什么?@Claies:我所有实体集的单数。我更新了我的问题,这样说。您的ApplicationData类是如何声明的?是ApplicationData:EntityFrameworkDataService还是ApplicationData:DataService?还是其他一些变体?@Claies:我在链接到EF6和Microsoft.Data.*时尝试了EntityFrameworkDataService,在链接到EF5时尝试了DataService,两者都产生了相同的单数而不是复数结果。在ODataConventionModelBuilder中有任何自定义吗?
/// <summary>Gets an object query for the entity set 'Accreditation', containing entity type 'Accreditation'</summary>
public DbSet<Accreditation> Accreditations { get; set; }
/// <summary>Gets an object query for the entity set 'AdditionalChargeTaxType', containing entity type 'AdditionalChargeTaxType'</summary>
public DbSet<AdditionalChargeTaxType> AdditionalChargeTaxTypes { get; set; }
/// <summary>Gets an object query for the entity set 'AdditionalChargeTaxTypeStateProvince', containing entity type 'AdditionalChargeTaxTypeStateProvince'</summary>
public DbSet<AdditionalChargeTaxTypeStateProvince> AdditionalChargeTaxTypeStateProvinces { get; set; }
/// <summary>Gets an object query for the entity set 'AdditionalChargeType', containing entity type 'AdditionalChargeType'</summary>
public DbSet<AdditionalChargeType> AdditionalChargeTypes { get; set; }
var query = (from w in context.Widgets select w); // Works with the plural "Widgets" as expected