/** * Complete reference `funcParamsSyntaxCollections` with given `param` into proper collections. */ protected void readFunctionParam(ExtObjectMember extObjectMember, MemberParam param, ref FuncParamsSyntaxCollections funcParamsSyntaxCollections, ref ParsedTypes?lastParamTypes, bool eventCompleting, string currentClassName, string eventOrMethodName, bool isStatic, bool eventsCompleting, int lastParamIndex, int paramIndex) { ParsedTypes paramTypes; bool lastParamDefinition = paramIndex == lastParamIndex; // Parse param types - this types parsing result could have more result method forms: // - most often is form with normal params syntax // - but sometimes there could be another send method form // with params spread syntax or only this syntax if (lastParamDefinition) { paramTypes = lastParamTypes.Value; } else { paramTypes = this.typesParser.Parse( eventCompleting ? TypeDefinitionPlace.EVENT_PARAM : TypeDefinitionPlace.METHOD_PARAM, currentClassName + "." + extObjectMember.Name, param.Name, param.Type ); } // If param contains any sub-definitions, then param is probably // some kind of configuration object, which has all it's members // defined in Ext documentation. Then it's practicle to generate sub-interface: if (param.Properties != null && param.Properties.Count > 0) { this.readFunctionParamSpecials( param, ref paramTypes, eventCompleting, currentClassName, eventOrMethodName, isStatic, eventCompleting ); } //if (currentClassName == "Ext" && eventOrMethodName == "create") // Debugger.Break(); // Add completed param types into proper collection with name, param docs and all it's flags: this.readFunctionParamAddToParamsList( param, ref funcParamsSyntaxCollections, ref paramTypes, currentClassName, eventCompleting, lastParamDefinition ); }
public async Task <string> QueryPagedAsync([FromQuery] MemberParam param) { var filter = param.SearchLambda <Member, MemberParam>(); var result = await _memberRepository.QueryPagedAsync(param.PageNum, param.PageSize, null, filter); //var list = new List<MemberDto>(); var list = result.Items.Select(c => c.EntityMap <Member, MemberDto>()).ToList(); var pageData = new PagedDto <MemberDto> { Code = 200, Msg = "获取数据成功", Total = result.TotalResults, PageSize = param.PageSize, Data = list }; var json = pageData.ToString(); return(json); }
protected void readFunctionParamAddToParamsList(MemberParam extObjectMemberParam, ref FuncParamsSyntaxCollections functionParamsSyntaxCollections, ref ParsedTypes paramTypes, string currentClassName, bool eventCompleting, bool lastParamDefinition) { bool optional = ( (extObjectMemberParam.Optional.HasValue && extObjectMemberParam.Optional.Value == true) || (extObjectMemberParam.Doc != null && extObjectMemberParam.Doc.ToLower().Contains("(optional)")) ); string[] docs = this.readJsDocs( extObjectMemberParam.Doc, (eventCompleting ? JsDocsType.EVENT_PARAM : JsDocsType.METHOD_PARAM), currentClassName, extObjectMemberParam.Name ); /*if (!lastParamDefinition) { * functionParamsSyntaxCollections.StandardParamsSyntax.Add(new Param( * this.sanitizeName(extObjectMemberParam.Name), * docs, * paramTypes.MethodOrEventParam, * optional, * false // not last param can NOT have spread syntax - so this could be fixed false * )); * } else {*/ // When last param types are parsed - it's necessary // to determinate single or multiple method forms by spread // and non-spread last param types if ( !functionParamsSyntaxCollections.SpreadParamFound && paramTypes.MethodOrEventParam.Count > 0 && paramTypes.MethodOrEventSpreadParam.Count > 0 ) { // There will be two method forms: functionParamsSyntaxCollections.SpreadParamFound = true; functionParamsSyntaxCollections.SpreadParamsSyntax = new List <Param>( functionParamsSyntaxCollections.StandardParamsSyntax ); functionParamsSyntaxCollections.SpreadParamsSyntax.Add(new Param( this.sanitizeName(extObjectMemberParam.Name), docs, paramTypes.MethodOrEventSpreadParam, optional, true )); functionParamsSyntaxCollections.StandardParamsSyntax.Add(new Param( this.sanitizeName(extObjectMemberParam.Name), docs, paramTypes.MethodOrEventParam, optional, false )); } else if (paramTypes.MethodOrEventParam.Count > 0) { // There will be only standard params method form: functionParamsSyntaxCollections.StandardParamsSyntax.Add(new Param( this.sanitizeName(extObjectMemberParam.Name), docs, paramTypes.MethodOrEventParam, optional, false )); } else if ( !functionParamsSyntaxCollections.SpreadParamFound && paramTypes.MethodOrEventSpreadParam.Count > 0 ) { if (functionParamsSyntaxCollections.StandardParamsSyntax.Count > 0) { // There is something in standard param(s) from previous param - duplicate everything into spread params collection first: functionParamsSyntaxCollections.SpreadParamFound = true; functionParamsSyntaxCollections.SpreadParamsSyntax = new List <Param>( functionParamsSyntaxCollections.StandardParamsSyntax ); functionParamsSyntaxCollections.SpreadParamsSyntax.Add(new Param( this.sanitizeName(extObjectMemberParam.Name), docs, paramTypes.MethodOrEventSpreadParam, optional, true )); } else { // Add into spread params collection: functionParamsSyntaxCollections.SpreadParamFound = true; functionParamsSyntaxCollections.SpreadParamsSyntax.Add(new Param( this.sanitizeName(extObjectMemberParam.Name), docs, paramTypes.MethodOrEventSpreadParam, optional, true )); } } //} }
protected void readFunctionParamSpecials( MemberParam param, ref ParsedTypes paramTypes, bool eventCompleting, string currentClassName, string eventOrMethodName, bool isStatic, bool eventsCompleting ) { string extParamsPseudoCallbackName; string extParamsPseudoClassName; SpecialParamTypes specialTypes = this.matchSpecStructParamInParamTypes(ref paramTypes); if ((specialTypes.Matches & SpecialParamMatch.ANY_FUNC) != 0) { // Described function callback as special class, not rendered later as type but directly: extParamsPseudoCallbackName = this.extClassMethodConfigObjectPresudoClassName( currentClassName, eventOrMethodName, isStatic, eventsCompleting, param.Name, false ); // `extParamsPseudoCallbackName = 'Ext.AbstractManager.methodsCallbackParams.each.Fn';` // `extParamsPseudoCallbackName = 'Ext.Class.staticMethodsCallbackParams.registerPreprocessor.Fn';` this.readFunctionParamCallbackProperties( extParamsPseudoCallbackName, eventOrMethodName, param.Doc, param.Properties, eventCompleting ); // Add described virtual callback type: if ((specialTypes.Matches & SpecialParamMatch.STANDARD_COLLECTION_FUNC) != 0) { paramTypes.MethodOrEventParam.Add(extParamsPseudoCallbackName); } if ((specialTypes.Matches & SpecialParamMatch.STANDARD_COLLECTION_FUNC_ARR) != 0) { paramTypes.MethodOrEventParam.Add(extParamsPseudoCallbackName + "[]"); } if ((specialTypes.Matches & SpecialParamMatch.SPREAD_COLLECTION_FUNC) != 0) { paramTypes.MethodOrEventSpreadParam.Add(extParamsPseudoCallbackName); } } if ((specialTypes.Matches & SpecialParamMatch.ANY_OBJECT) != 0) { // Described config object as special class, rendered later as type, // extended from `Object` TypeScript interface: extParamsPseudoClassName = this.extClassMethodConfigObjectPresudoClassName( currentClassName, eventOrMethodName, isStatic, eventsCompleting, param.Name, true ); // `extParamsPseudoClassName = 'Ext.Ajax.methodsParams.addListener.Options';` // `extParamsPseudoClassName = 'Ext.data.Model.staticMethodsParams.load.Options';` this.readFunctionParamConfObjectProperties( currentClassName, extParamsPseudoClassName, eventOrMethodName, "Object", param.Doc, param.Properties, eventCompleting, isStatic ); if ((specialTypes.Matches & SpecialParamMatch.STANDARD_COLLECTION_OBJECT) != 0) { paramTypes.MethodOrEventParam.Add(extParamsPseudoClassName); } if ((specialTypes.Matches & SpecialParamMatch.STANDARD_COLLECTION_OBJECT_ARR) != 0) { paramTypes.MethodOrEventParam.Add(extParamsPseudoClassName + "[]"); } if ((specialTypes.Matches & SpecialParamMatch.SPREAD_COLLECTION_OBJECT) != 0) { paramTypes.MethodOrEventSpreadParam.Add(extParamsPseudoClassName); } } if ((specialTypes.Matches & SpecialParamMatch.ANY_INTERFACE) != 0) { // Described config object as special class, rendered later as type, // extended from given interface(s): bool numberTypes = specialTypes.MethodOrEventAllParamTypes.Count > 1; int index = 1; bool specTypeIsArr; bool typeIsForStandardCollection; bool typeIsforSpreadCollection; foreach (string specialTypeParent in specialTypes.MethodOrEventAllParamTypes) { specTypeIsArr = specialTypeParent.EndsWith("[]"); extParamsPseudoClassName = this.extClassMethodConfigObjectPresudoClassName( currentClassName, eventOrMethodName, isStatic, eventsCompleting, param.Name, true ); // `extParamsPseudoClassName = 'Ext.button.Segmented.methodsParams.onFocusLeave.E';` if (numberTypes) { extParamsPseudoClassName += index.ToString(); } this.readFunctionParamConfObjectProperties( currentClassName, extParamsPseudoClassName, eventOrMethodName, specTypeIsArr ? specialTypeParent.Substring(0, specialTypeParent.Length - 2) : specialTypeParent, param.Doc, param.Properties, eventCompleting, isStatic ); typeIsForStandardCollection = specialTypes.MethodOrEventParamTypes.Contains(specialTypeParent); typeIsforSpreadCollection = specialTypes.MethodOrEventSpreadParamTypes.Contains(specialTypeParent); if ( typeIsForStandardCollection && (specialTypes.Matches & SpecialParamMatch.STANDARD_COLLECTION_INTERFACE) != 0 ) { paramTypes.MethodOrEventParam.Add(extParamsPseudoClassName); } if ( typeIsForStandardCollection && specTypeIsArr && (specialTypes.Matches & SpecialParamMatch.STANDARD_COLLECTION_INTERFACE_ARR) != 0 ) { paramTypes.MethodOrEventParam.Add(extParamsPseudoClassName + "[]"); } if ( typeIsforSpreadCollection && (specialTypes.Matches & SpecialParamMatch.SPREAD_COLLECTION_INTERFACE) != 0 ) { paramTypes.MethodOrEventSpreadParam.Add(extParamsPseudoClassName); } index += 1; } } }