Ejemplo n.º 1
0
        private ClassDefinition GetClassDefinition(object obj)
        {
            ClassDefinition classDefinition = null;

            if (obj is ASObject)
            {
                IObjectProxy proxy = ObjectProxyRegistry.Instance.GetObjectProxy(typeof(ASObject));

                classDefinition = proxy.GetClassDefinition((ASObject)obj);
            }
            else
            {
                IObjectProxy proxy = ObjectProxyRegistry.Instance.GetObjectProxy(obj.GetType());

                classDefinition = proxy.GetClassDefinition(obj);
            }

            return(classDefinition);
        }
Ejemplo n.º 2
0
        private ClassDefinition GetClassDefinition(object obj)
        {
            ClassDefinition classDefinition = null;

            if (obj is ASObject)
            {
                ASObject asObject = obj as ASObject;
                if (asObject.IsTypedObject)
                {
                    classDefinitions.TryGetValue(asObject.TypeName, out classDefinition);
                }
                if (classDefinition != null)
                {
                    return(classDefinition);
                }

                IObjectProxy proxy = ObjectProxyRegistry.GetObjectProxy(typeof(ASObject));
                classDefinition = proxy.GetClassDefinition(obj);
                if (asObject.IsTypedObject)
                {
                    //Only typed ASObject class definitions are cached.
                    classDefinitions[asObject.TypeName] = classDefinition;
                }
            }
            else
            {
                string typeName = obj.GetType().FullName;
                if (!classDefinitions.TryGetValue(typeName, out classDefinition))
                {
                    IObjectProxy proxy = ObjectProxyRegistry.GetObjectProxy(obj.GetType());
                    classDefinition            = proxy.GetClassDefinition(obj);
                    classDefinitions[typeName] = classDefinition;
                }
            }

            return(classDefinition);
        }