예제 #1
0
        public bool TryGetAttachedPropertyType(string typeNamespace, string typeName, out AttachedPropertyObjectType attachedPropertyObjectType)
        {
            string assemblyTypeName = ObjectInstanceTypeCache.CalculateTypeName(typeNamespace, typeName);

            if (!this.attachedPropertyTypeCache.TryGetValue(assemblyTypeName, out attachedPropertyObjectType))
            {
                Assembly assembly;
                if (!this.namespaceAssemblyCache.TryGetValue(typeNamespace, out assembly))
                {
                    return(false);
                }

                Type type = assembly.GetType(assemblyTypeName, false);
                if (type == null)
                {
                    return(false);
                }

                if (!AttachedPropertyObjectType.TryCreate(type, out attachedPropertyObjectType))
                {
                    return(false);
                }

                this.attachedPropertyTypeCache.Add(assemblyTypeName, attachedPropertyObjectType);
            }

            return(true);
        }
예제 #2
0
        public bool TryGetObjectInstanceType(string typeNamespace, string typeName, out ObjectInstanceType objectInstanceType)
        {
            string assemblyTypeName = ObjectInstanceTypeCache.CalculateTypeName(typeNamespace, typeName);

            if (!this.objectInstanceTypeCache.TryGetValue(assemblyTypeName, out objectInstanceType))
            {
                Assembly assembly;
                if (!this.namespaceAssemblyCache.TryGetValue(typeNamespace, out assembly))
                {
                    return(false);
                }

                Type type = assembly.GetType(assemblyTypeName, false);
                if (type == null)
                {
                    return(false);
                }

                objectInstanceType = new ObjectInstanceType(type);
                this.objectInstanceTypeCache.Add(assemblyTypeName, objectInstanceType);
            }

            return(true);
        }