Skip to content

Commit 1deec52

Browse files
LuukN2commonsensesoftware
authored andcommitted
Fixed underlying property type having the same name as the property.
1 parent 26d3e0d commit 1deec52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Common.OData.ApiExplorer/AspNet.OData/DefaultModelTypeBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ private void ResolveForUnfinishedTypes()
285285
static PropertyBuilder AddProperty( TypeBuilder addTo, Type shouldBeAdded, string name )
286286
{
287287
const MethodAttributes propertyMethodAttributes = MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig;
288-
var field = addTo.DefineField( name, shouldBeAdded, FieldAttributes.Private );
288+
var field = addTo.DefineField( "_" + name, shouldBeAdded, FieldAttributes.Private );
289289
var propertyBuilder = addTo.DefineProperty( name, PropertyAttributes.HasDefault, shouldBeAdded, null );
290290
var getter = addTo.DefineMethod( "get_" + name, propertyMethodAttributes, shouldBeAdded, Type.EmptyTypes );
291291
var setter = addTo.DefineMethod( "set_" + name, propertyMethodAttributes, shouldBeAdded, Type.EmptyTypes );

0 commit comments

Comments
 (0)