示例#1
0
            /// <summary>
            /// 安装下一个类型
            /// </summary>
            protected override void nextCreate()
            {
                bool isPoolType = typeof(AutoCSer.WebView.Ajax <>).isAssignableFromGenericDefinition(Type);

                if (isPoolType)
                {
                    if (Attribute == null)
                    {
                        Attribute = AutoCSer.WebView.Ajax.DefaultAttribute;
                    }
                }
                else
                {
                    if (Attribute == null)
                    {
                        return;
                    }
                    if (!typeof(AutoCSer.WebView.Ajax).IsAssignableFrom(Type))
                    {
                        Messages.Add(Type.FullName + " 必须继承自 AutoCSer.WebView.Ajax 或者 AutoCSer.WebView.Ajax<" + Type.FullName + ">");
                        return;
                    }
                }

                string typeCallName = Type.FullName;

                if (typeCallName.StartsWith(AutoParameter.DefaultNamespace, StringComparison.Ordinal) && typeCallName[AutoParameter.DefaultNamespace.Length] == '.')
                {
                    typeCallName = typeCallName.Substring(AutoParameter.DefaultNamespace.Length + 1);
                }
                if (typeCallName.StartsWith("Ajax.", StringComparison.Ordinal))
                {
                    typeCallName = typeCallName.Substring("Ajax.".Length);
                }

                int methodIndex = methods.Length;

                AjaxMethod[] methodIndexs = Metadata.MethodIndex.GetMethods <AutoCSer.WebView.AjaxMethodAttribute>(Type, AutoCSer.Metadata.MemberFilters.PublicInstance, false, Attribute.IsAttribute, Attribute.IsBaseTypeAttribute)
                                            .getArray(value => new AjaxMethod
                {
                    Method            = value,
                    MethodIndex       = methodIndex++,
                    WebAjaxMethodType = Type,
                    TypeAttribute     = Attribute,
                    TypeCallName      = typeCallName,
                    IgnoreCase        = AutoParameter.WebConfig.IgnoreCase,
                    IsPoolType        = isPoolType
                });
                if (methodIndexs.Length != 0)
                {
                    methods.Add(methodIndexs);
                    if (Attribute.IsExportTypeScript)
                    {
                        typeScript.Create(AutoParameter, Type, methodIndexs);
                    }
                }
            }