static void CacheRemotableConstructor(String aliasOrTypeName, RemotableConstructor c)
        {
            List <RemotableConstructor> list;

            if (!constructorCache.TryGetValue(aliasOrTypeName, out list))
            {
                constructorCache.TryAdd(aliasOrTypeName, list = new List <RemotableConstructor>());
            }

            if (list.Count > 0 && list[0].ConstructorInfo.DeclaringType != c.ConstructorInfo.DeclaringType)
            {
                throw new DextopException("Remotable constructor clash detected. Constructors for remotable types '{0}' and '{1} have the same alias '{2}'. Change alias for one of the types.", list[0].ConstructorInfo.DeclaringType, c.ConstructorInfo.DeclaringType, aliasOrTypeName);
            }

            list.Add(c);
        }
Пример #2
0
        internal static void CacheConstructorInfo(String typeName, ConstructorInfo methodInfo, DextopRemotableAttribute att)
        {
            var m = new RemotableConstructor
            {
                ConstructorInfo = methodInfo,
                Args            = methodInfo.GetParameters().ToArray()
            };

            constructorCache.TryAdd(typeName, m);
            var ca = att as DextopRemotableConstructorAttribute;

            if (ca != null && ca.alias != null)
            {
                constructorCache.TryAdd(ca.alias, m);
            }
        }
        internal static void CacheConstructorInfo(String typeName, ConstructorInfo methodInfo, DextopRemotableAttribute att)
        {
            var m = new RemotableConstructor
            {
                ConstructorInfo = methodInfo,
                Args            = methodInfo.GetParameters().ToArray()
            };

            CacheRemotableConstructor(typeName, m);

            var ca = att as DextopRemotableConstructorAttribute;

            if (ca != null && ca.alias != null && ca.alias != typeName)
            {
                CacheRemotableConstructor(ca.alias, m);
            }

            if (ca != null && ca.route != null)
            {
                CacheConstructorRoute(ca.route, typeName);
            }
        }
 internal static void CacheConstructorInfo(String typeName, ConstructorInfo methodInfo, DextopRemotableAttribute att)
 {
     var m = new RemotableConstructor
     {
         ConstructorInfo = methodInfo,
         Args = methodInfo.GetParameters().ToArray()
     };
     constructorCache.TryAdd(typeName, m);
     var ca = att as DextopRemotableConstructorAttribute;
     if (ca!=null && ca.alias!=null)
     {
         constructorCache.TryAdd(ca.alias, m);
     }
 }
        internal static void CacheConstructorInfo(String typeName, ConstructorInfo methodInfo, DextopRemotableAttribute att)
        {
            var m = new RemotableConstructor
            {
                ConstructorInfo = methodInfo,
                Args = methodInfo.GetParameters().ToArray()
            };

            CacheRemotableConstructor(typeName, m);

            var ca = att as DextopRemotableConstructorAttribute;
            if (ca != null && ca.alias != null && ca.alias != typeName)
                CacheRemotableConstructor(ca.alias, m);

            if (ca != null && ca.route != null)
                CacheConstructorRoute(ca.route, typeName);
        }
        static void CacheRemotableConstructor(String aliasOrTypeName, RemotableConstructor c)
        {
            List<RemotableConstructor> list;
            if (!constructorCache.TryGetValue(aliasOrTypeName, out list))
                constructorCache.TryAdd(aliasOrTypeName, list = new List<RemotableConstructor>());

            if (list.Count > 0 && list[0].ConstructorInfo.DeclaringType != c.ConstructorInfo.DeclaringType)
                throw new DextopException("Remotable constructor clash detected. Constructors for remotable types '{0}' and '{1} have the same alias '{2}'. Change alias for one of the types.", list[0].ConstructorInfo.DeclaringType, c.ConstructorInfo.DeclaringType, aliasOrTypeName);

            list.Add(c);
        }