Skip to content
This repository was archived by the owner on Nov 25, 2019. It is now read-only.

Commit adb4137

Browse files
author
raghuramn
committed
Issue 534: Error creating multiple entity sets for an entity type in
Conventional mb. Forgot to include the source entity set name in the error message in earlier commit. Including it now.
1 parent 15e7a61 commit adb4137

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/System.Web.Http.OData/OData/Builder/EntitySetConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ public NavigationPropertyBinding FindBinding(NavigationPropertyConfiguration nav
208208
SRResources.CannotAutoCreateMultipleCandidates,
209209
navigationConfiguration.Name,
210210
navigationConfiguration.DeclaringEntityType.FullName,
211+
Name,
211212
String.Join(", ", matchingSets.Select(entitySet => entitySet.Name)));
212213
}
213214
}

src/System.Web.Http.OData/Properties/SRResources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/System.Web.Http.OData/Properties/SRResources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
<value>The type '{0}' is not supported by the ODataErrorSerializer. The type must be ODataError or HttpError.</value>
227227
</data>
228228
<data name="CannotAutoCreateMultipleCandidates" xml:space="preserve">
229-
<value>Cannot automatically bind the navigation property '{0}' on entity type '{1}' because there are two or more candidate entity sets. The matching entity sets are {2}.</value>
229+
<value>Cannot automatically bind the navigation property '{0}' on entity type '{1}' for the source entity set '{2}' because there are two or more matching target entity sets. The matching entity sets are {3}.</value>
230230
</data>
231231
<data name="EntitySetHasNoBuildLinkAnnotation" xml:space="preserve">
232232
<value>The entity set '{0}' is missing link generation configuration. Check that the self and edit links are configured during model building.</value>

test/System.Web.Http.OData.Test/OData/Builder/EntitySetTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ public void CanConfigureLinks_For_NavigationPropertiesInDerivedType()
232232
public void CannotBindNavigationPropertyAutmatically_WhenMultipleEntitySetsOfPropertyType_Exist()
233233
{
234234
ODataModelBuilder builder = new ODataModelBuilder();
235-
builder.EntitySet<Motorcycle>("motorcycles");
235+
builder.EntitySet<Motorcycle>("motorcycles1").HasRequiredBinding(m => m.Manufacturer, "NorthWestMotorcycleManufacturers");
236+
builder.EntitySet<Motorcycle>("motorcycles2");
236237
builder.EntitySet<MotorcycleManufacturer>("NorthWestMotorcycleManufacturers");
237238
builder.EntitySet<MotorcycleManufacturer>("SouthWestMotorcycleManufacturers");
238-
builder.Entity<Motorcycle>().HasRequired(m => m.Manufacturer);
239239

240240
Assert.Throws<NotSupportedException>(
241241
() => builder.GetEdmModel(),
242-
"Cannot automatically bind the navigation property 'Manufacturer' on entity type 'System.Web.Http.OData.Builder.TestModels.Motorcycle' because there are two or more candidate entity sets. " +
242+
"Cannot automatically bind the navigation property 'Manufacturer' on entity type 'System.Web.Http.OData.Builder.TestModels.Motorcycle' for the source entity set 'motorcycles2' because there are two or more matching target entity sets. " +
243243
"The matching entity sets are NorthWestMotorcycleManufacturers, SouthWestMotorcycleManufacturers.");
244244
}
245245
}

0 commit comments

Comments
 (0)