/// <summary> /// Looks for the property of the <paramref name="userType"/> that match the <paramref name="proxyPropertyType"/> /// </summary> /// <param name="userType">The <see cref="Type"/> that declares the property</param> /// <param name="proxyPropertyType">The <see cref="Type"/> of the property to look for</param> /// <param name="propertyName">The name of the property in the <paramref name="userType"/></param> /// <returns>The <see cref="PropertyInfo"/> for the property if exists otherwise null</returns> private static PropertyInfo GetUserPropertyFromProxyPropertyType(Type userType, Type proxyPropertyType, string propertyName) { if (proxyPropertyType.IsCollection()) { return(CollectionProxies .Where(c => c.Value.ProxyCollectionType == proxyPropertyType) .Select(c => userType.GetProperty(propertyName, c.Key.MakeArrayType())) .FirstOrDefault(prop => prop != null)); } else { return(Proxies .Where(c => c.Value.ProxyType == proxyPropertyType) .Select(c => userType.GetProperty(propertyName, c.Key)) .FirstOrDefault(prop => prop != null)); } }
/// <summary> /// Gets the first collection proxy type registered to the <paramref name="udtCollectionName"/> /// </summary> /// <param name="udtCollectionName">The udt collection name to look for</param> /// <returns>The first collection registered with that name or the default value otherwise</returns> private static (Type ProxyType, string UDTCollectionName) GetCollectionProxyTypeFromUdtName(string udtCollectionName) { return(CollectionProxies.Where(c => c.Value.UdtCollectionName == udtCollectionName) .Select(c => c.Value) .FirstOrDefault()); }