public IdentifierMethod FindIdentifierMethodFor(Type type) { IdentifierMethod identifierMethod = null; if(!methods.TryGetValue(type, out identifierMethod)) { identifierMethod=new IdentifierMethod(); var typeMemberInfos = CommonUtility.GetFieldsAndProperties_PublicInstance(type); foreach (var m in typeMemberInfos) { string resolvedName = setting.Collection.ResolvePropertyName(type, m.Name); switch(resolvedName) { case "_key": identifierMethod.SetKey = BuildSetAccessor(type,m.Name); break; case "_id": identifierMethod.SetHandle = BuildSetAccessor(type, m.Name); break; case "_rev": identifierMethod.SetRevision = BuildSetAccessor(type, m.Name); break; case "_from": identifierMethod.SetFrom = BuildSetAccessor(type, m.Name); break; case "_to": identifierMethod.SetTo = BuildSetAccessor(type, m.Name); break; } } } return identifierMethod; }
public IdentifierMethod FindIdentifierMethodFor(Type type) { IdentifierMethod identifierMethod = null; if (!methods.TryGetValue(type, out identifierMethod)) { identifierMethod = new IdentifierMethod(); var typeMemberInfos = ReflectionUtils.GetFieldsAndProperties_PublicInstance(type); foreach (var m in typeMemberInfos) { string resolvedName = setting.Collection.ResolvePropertyName(type, m.Name); switch (resolvedName) { case "_key": identifierMethod.SetKey = BuildSetAccessor(type, m.Name); break; case "_id": identifierMethod.SetHandle = BuildSetAccessor(type, m.Name); break; case "_rev": identifierMethod.SetRevision = BuildSetAccessor(type, m.Name); break; case "_from": identifierMethod.SetFrom = BuildSetAccessor(type, m.Name); break; case "_to": identifierMethod.SetTo = BuildSetAccessor(type, m.Name); break; } } } return(identifierMethod); }
internal void ClearMethodCache(Type type) { IdentifierMethod identifierMethod = null; methods.TryRemove(type, out identifierMethod); }