/// <summary> /// Gets MemberInfo that refers to Id from a document object. /// </summary> protected virtual MemberInfo GetIdMember(IEnumerable <MemberInfo> members) { return(Reflection.SelectMember(members, x => Attribute.IsDefined(x, typeof(BsonIdAttribute), true), x => x.Name.Equals("Id", StringComparison.OrdinalIgnoreCase), x => x.Name.Equals(x.DeclaringType.Name + "Id", StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Gets MemberInfo that refers to Id from a document object. /// </summary> protected virtual MemberInfo GetIdMember(IEnumerable <MemberInfo> members) { return(Reflection.SelectMember(members, #if HAVE_ATTR_DEFINED x => Attribute.IsDefined(x, typeof(BsonIdAttribute), true), #else x => x.GetCustomAttribute(typeof(BsonIdAttribute)) != null, #endif x => x.Name.Equals("Id", StringComparison.OrdinalIgnoreCase), x => x.Name.Equals(x.DeclaringType.Name + "Id", StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Gets MemberInfo that refers to Id from a document object. /// </summary> protected virtual MemberInfo GetIdMember(IEnumerable <MemberInfo> members) { // Get all members and test in order: BsonIdAttribute, "Id" name, "<typeName>Id" name in this order return(Reflection.SelectMember(members, #if NETFULL x => Attribute.IsDefined(x, typeof(BsonIdAttribute), true), #else x => x.GetCustomAttribute(typeof(BsonIdAttribute)) != null, #endif x => x.Name.Equals("Id", StringComparison.OrdinalIgnoreCase), x => x.Name.Equals(x.DeclaringType.Name + "Id", StringComparison.OrdinalIgnoreCase))); }