Skip to content

Commit 0b49c86

Browse files
Chris Martinezcommonsensesoftware
authored andcommitted
Add appropriate separators for composite keys. Fixes #500
1 parent 9b91ced commit 0b49c86

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Common.OData.ApiExplorer/AspNet.OData/Routing/ODataRouteBuilder.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,16 @@ void AppendEntityKeysFromConvention( StringBuilder builder )
175175
}
176176

177177
var useParentheses = Context.UrlKeyDelimiter == Parentheses;
178+
var keySeparator = ',';
178179

179180
if ( useParentheses )
180181
{
181182
builder.Append( '(' );
182183
}
183184
else
184185
{
185-
builder.Append( '/' );
186+
keySeparator = '/';
187+
builder.Append( keySeparator );
186188
}
187189

188190
if ( entityKeys.Length == 1 )
@@ -191,8 +193,11 @@ void AppendEntityKeysFromConvention( StringBuilder builder )
191193
}
192194
else
193195
{
194-
for ( var i = 0; i < entityKeys.Length; i++ )
196+
ExpandParameterTemplate( builder, entityKeys[0], parameterKeys[0].Name );
197+
198+
for ( var i = 1; i < entityKeys.Length; i++ )
195199
{
200+
builder.Append( keySeparator );
196201
ExpandParameterTemplate( builder, entityKeys[i], parameterKeys[i].Name );
197202
}
198203
}

0 commit comments

Comments
 (0)