/// <summary> /// Retrieves the specified key property for the provided type. /// </summary> /// <param name="type">The type.</param> /// <returns>The key property.</returns> protected virtual PropertyInfo GetKeySelector(Type type) { KeySelectorMap.TryGetValue(type, out PropertyInfo prop); if (prop == null) { throw new Exception($"There is no key property specified for {type.Name} or it is invalid."); } return(prop); }