Skip to content

Commit 503adf0

Browse files
committed
code review comments.
1 parent 24eba90 commit 503adf0

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

MongoDB.Bson/Serialization/BsonClassMap.cs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,28 +1562,11 @@ private static MemberInfo GetMemberInfoFromLambda<TMember>(Expression<Func<TClas
15621562
switch (memberInfo.MemberType)
15631563
{
15641564
case MemberTypes.Field:
1565-
memberInfo = typeof(TClass).GetField(
1566-
memberInfo.Name,
1567-
BindingFlags.Instance |
1568-
BindingFlags.Public |
1569-
BindingFlags.NonPublic);
15701565
break;
15711566
case MemberTypes.Property:
1572-
// Handle interfaces and base classes; lambdas always
1573-
// call the derived implementation.
1574-
if (memberInfo.DeclaringType != typeof(TClass))
1567+
if (memberInfo.DeclaringType.IsInterface)
15751568
{
1576-
var memberInfo2 = typeof(TClass).GetProperty(
1577-
memberInfo.Name,
1578-
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
1579-
1580-
// Handle explicit interface implementations.
1581-
if (memberInfo2 == null && memberInfo.DeclaringType.IsInterface)
1582-
{
1583-
memberInfo2 = ResolveExplicitProperty(memberInfo, typeof(TClass));
1584-
}
1585-
1586-
memberInfo = memberInfo2;
1569+
memberInfo = ResolveExplicitProperty(memberInfo, typeof(TClass));
15871570
}
15881571
break;
15891572
default:

MongoDB.BsonUnitTests/Jira/CSharp637Tests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2010-2012 10gen Inc.
1+
/* Copyright 2010-2013 10gen Inc.
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
@@ -13,11 +13,10 @@
1313
* limitations under the License.
1414
*/
1515

16-
using NUnit.Framework;
17-
1816
using MongoDB.Bson;
1917
using MongoDB.Bson.Serialization;
2018
using MongoDB.Bson.Serialization.Attributes;
19+
using NUnit.Framework;
2120

2221
namespace MongoDB.BsonUnitTests.Jira.CSharp637
2322
{

0 commit comments

Comments
 (0)