public static Into insert( this MongoDatabase database, object document ) { var query_settings = new QuerySettings(); query_settings.MongoDatabase = database; query_settings.Document = document; return new Into( query_settings ); }
public static Update update( this MongoDatabase database, Guid id ) { var query_settings = new QuerySettings(); query_settings.MongoDatabase = database; query_settings.Id = id; return new Update( query_settings ); }
public static Statements.Statements from_collection( this MongoDatabase database, string collection_name ) { var query_settings = new QuerySettings(); query_settings.CollectionName = collection_name; query_settings.MongoDatabase = database; return new Statements.Statements( query_settings ); }
public OpenSearchRequest Create(QuerySettings querySettings, NameValueCollection parameters) { UriBuilder url = new UriBuilder("dummy://localhost"); url.Path += Identifier + "/search"; var array = (from key in parameters.AllKeys from value in parameters.GetValues(key) select string.Format("{0}={1}", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(value))) .ToArray(); url.Query = string.Join("&", array); AtomOpenSearchRequest request = new AtomOpenSearchRequest(new OpenSearchUrl(url.Uri), SearchInAtom); return request; }
public OpenSearchRequest Create(QuerySettings querySettings, NameValueCollection parameters) { UriBuilder url = new UriBuilder("dummy://localhost"); url.Path += "illtest/search"; var array = (from key in parameters.AllKeys from value in parameters.GetValues(key) select string.Format("{0}={1}", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(value))) .ToArray(); url.Query = string.Join("&", array); IllimitedOpenSearchRequest<AtomFeed, AtomItem> request = new IllimitedOpenSearchRequest<AtomFeed, AtomItem>(ose, entity, querySettings.PreferredContentType, new OpenSearchUrl(url.Uri)); return request; }
/// <summary> /// Builds the request URL for template. /// </summary> /// <returns>The request URL for template.</returns> /// <param name="remoteUrlTemplate">Remote URL template.</param> /// <param name="searchParameters">Search parameters.</param> public static OpenSearchUrl BuildRequestUrlForTemplate(OpenSearchDescriptionUrl remoteUrlTemplate, NameValueCollection searchParameters, QuerySettings querySettings) { // container for the final query url UriBuilder finalUrl = new UriBuilder(remoteUrlTemplate.Template); // parameters for final query NameValueCollection finalQueryParameters = new NameValueCollection(); // Parse the possible parametrs of the remote urls NameValueCollection remoteParametersDef = HttpUtility.ParseQueryString(finalUrl.Query); // For each parameter requested foreach (string parameter_id in searchParameters.AllKeys) { if (remoteParametersDef[parameter_id] == null) { // if forced, set the param if (querySettings.ForceUnspecifiedParameters) { if (!(querySettings.SkipNullOrEmptyQueryStringParameters && string.IsNullOrEmpty(searchParameters[parameter_id]))) finalQueryParameters.Set(parameter_id, searchParameters[parameter_id]); } continue; } // first find the defintion of the parameter in the url template foreach (var key in remoteParametersDef.GetValues(parameter_id)) { Match matchParamDef = Regex.Match(key, @"^{([^?]+)\??}$"); // If parameter does not exist, continue if (!matchParamDef.Success) continue; // We have the parameter defintion string paramDef = matchParamDef.Groups[1].Value; string paramValue = searchParameters[parameter_id]; if ( !(querySettings.SkipNullOrEmptyQueryStringParameters && string.IsNullOrEmpty(paramValue))) finalQueryParameters.Set(parameter_id, paramValue); } } string[] queryString = Array.ConvertAll(finalQueryParameters.AllKeys, key => string.Format("{0}={1}", key, HttpUtility.UrlEncode(finalQueryParameters[key]))); finalUrl.Query = string.Join("&", queryString); return new OpenSearchUrl(finalUrl.Uri); }
internal void RunQuery(string sql, QueryProcessingStage stage, QuerySettings settings, ClientInfo clientInfo, IEnumerable <Block> xtables, bool noData) { try { if (_connectionSettings.Trace) { Trace.WriteLine($"Executing sql \"{sql}\"", "ClickHouse.Ado"); } WriteUInt((int)ClientMessageType.Query); WriteString(""); if (ServerInfo.Build >= ProtocolCaps.DbmsMinRevisionWithClientInfo) { if (clientInfo == null) { clientInfo = ClientInfo; } else { clientInfo.QueryKind = QueryKind.Secondary; } clientInfo.Write(this, _connectionSettings.ClientName); } var compressionMethod = _compressor != null ? _compressor.Method : CompressionMethod.Lz4; if (settings != null) { settings.Write(this); compressionMethod = settings.Get <CompressionMethod>("compression_method"); } else { WriteString(""); } WriteUInt((int)stage); WriteUInt(_connectionSettings.Compress ? (int)compressionMethod : 0); WriteString(sql); _baseStream.Flush(); if (ServerInfo.Build >= ProtocolCaps.DbmsMinRevisionWithTemporaryTables && noData) { new Block().Write(this); _baseStream.Flush(); } if (ServerInfo.Build >= ProtocolCaps.DbmsMinRevisionWithTemporaryTables) { SendBlocks(xtables); } } catch (Exception e) { _owner.MaybeSetBroken(e); throw; } }
public static string GetWallPostsMarkup(string contextPath, List <PostInfo> posts) { if (posts.Count == 0) { return(string.Empty); } // create query for comments and likes var csb = new StringBuilder(); var paths = new List <string>(); foreach (var postInfo in posts) { if (postInfo.IsJournal) { continue; } paths.Add(postInfo.Path); } List <Node> allComments; List <Node> allLikes; if (paths.Count == 0) // only non-persisted journal posts are there to show (no comments or likes) { allComments = new List <Node>(); allLikes = new List <Node>(); } else { var settings = new QuerySettings() { EnableAutofilters = FilterStatus.Disabled }; var allCommentsAndLikes = ContentQuery.Query(ContentRepository.SafeQueries.InTreeAndTypeIs, settings, paths, new[] { "Comment", "Like" }).Nodes.ToList(); var commentNodeTypeId = NodeType.GetByName("Comment").Id; var likeTypeId = NodeType.GetByName("Like").Id; allComments = allCommentsAndLikes.Where(c => c.NodeTypeId == commentNodeTypeId).ToList(); allLikes = allCommentsAndLikes.Where(l => l.NodeTypeId == likeTypeId).ToList(); } var bigPostMarkupStr = GetBigPostMarkupStr(); var smallPostMarkupStr = GetSmallPostMarkupStr(); var commentMarkupStr = GetCommentMarkupStr(); var commentSectionStr = GetCommentSectionMarkupStr(); PostInfo prevPost = null; var sb = new StringBuilder(); foreach (var postInfo in posts) { // get comments and likes for post CommentInfo commentInfo; LikeInfo likeInfo; if (postInfo.IsJournal) { commentInfo = new CommentInfo(); likeInfo = new LikeInfo(); } else { var commentsForPost = allComments.Where(c => RepositoryPath.GetParentPath(RepositoryPath.GetParentPath(c.Path)) == postInfo.Path).ToList(); var likesForPostAndComments = allLikes.Where(l => l.Path.StartsWith(postInfo.Path)).ToList(); var likesForPost = likesForPostAndComments.Where(l => RepositoryPath.GetParentPath(RepositoryPath.GetParentPath(l.Path)) == postInfo.Path).ToList(); commentInfo = new CommentInfo(commentsForPost, likesForPostAndComments, commentMarkupStr); likeInfo = new LikeInfo(likesForPost, postInfo.Id); } var drawBoundary = (prevPost != null) && (prevPost.Type != PostType.BigPost) && (postInfo.Type == PostType.BigPost); var markup = WallHelper.GetPostMarkup( postInfo.Type == PostType.BigPost ? bigPostMarkupStr : smallPostMarkupStr, commentSectionStr, postInfo, contextPath, commentInfo.HiddenCommentsMarkup, commentInfo.CommentsMarkup, commentInfo.CommentCount, likeInfo, drawBoundary); prevPost = postInfo; sb.Append(markup); } return(sb.ToString()); }
public Terradue.OpenSearch.Request.OpenSearchRequest Create(QuerySettings querySettings, System.Collections.Specialized.NameValueCollection parameters) { log.DebugFormat("Create OS QC Sentinel1"); UriBuilder url = new UriBuilder(qcBaseUrl); url.Path += string.Format("/search"); url.Query = string.Format("type={3}&start={0}&stop={1}&startIndex={2}&ills=true", parameters["start"], parameters["stop"], parameters["startIndex"], string.IsNullOrEmpty(parameters["auxtype"]) ? "aux_resorb" : parameters["auxtype"]); //if (parameters["ills"] == "true") //{ return new Sentinel1QcOpenSearchRequest(url.Uri, parameters); //} NameValueCollection illParams = new NameValueCollection(parameters); illParams.Set("ills", "true"); return new IllimitedOpenSearchRequest<AtomFeed, AtomItem>(ose, this, "application/atom+xml", new OpenSearchUrl(url.Uri), illParams); }
/* ====================================================================================================== Methods */ private void BuildList() { //store the selected value for using it after the list is repopulated //(storing the index is not correct, we have to use the value) var selVal = this.SelectedIndex > 0 ? this.SelectedValue : null; //we have to clear the itemlist here to //refresh the item collection if changed this.Items.Clear(); if (this.DropdownOptions.CommonType == DropDownCommonType.ContentTypeDropdown) { // special use-case, content type list is defined in webconfig NodeQueryResult contentTypeNames = GetWebContentTypeList(); if (contentTypeNames.Count > 0) { foreach (var ctContent in contentTypeNames.Nodes.Select(Content.Create)) { this.Items.Add(new ListItem(ctContent.DisplayName, ctContent.Name)); } } } if (!string.IsNullOrEmpty(this.DropdownOptions.Query)) { // the list is built up from a query var sortinfo = new List <SortInfo>() { new SortInfo() { FieldName = "Name", Reverse = false } }; var settings = new QuerySettings() { EnableAutofilters = FilterStatus.Disabled, Sort = sortinfo }; var query = ContentQuery.CreateQuery(this.DropdownOptions.Query, settings); var result = query.Execute(); if (result.Count == 0) { this.Items.Add(new ListItem(ResourceManager.Current.GetString("PortletFramework", "DropDown-NoItems"), string.Empty)); return; } this.Items.Add(new ListItem(ResourceManager.Current.GetString("PortletFramework", "DropDown-SelectOne"), string.Empty)); foreach (var content in result.Nodes.Select(Content.Create)) { this.Items.Add(new ListItem(content.DisplayName, content.Name)); } } //re-select the original selected value if needed if (selVal != null) { var index = 0; foreach (ListItem item in this.Items) { if (selVal.CompareTo(item.Value) == 0) { this.SelectedIndex = index; break; } index++; } } }
internal ParallelQuery(QuerySettings specifiedSettings) { _specifiedSettings = specifiedSettings; }
public static void Start() { if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod())) { Navigator.AddSettings(new List <EntitySettings> { new EntitySettings <EmployeeEntity>() { View = e => new Employee() }, new EntitySettings <TerritoryEntity>() { View = e => new Territory() }, new EntitySettings <RegionEntity>() { View = e => new Region() }, new EntitySettings <ProductEntity>() { View = e => new Product() }, new EntitySettings <CategoryEntity>() { View = e => new Category(), IsViewable = true }, new EntitySettings <SupplierEntity>() { View = e => new Supplier() }, new EntitySettings <CompanyEntity>() { View = e => new Company() }, new EntitySettings <PersonEntity>() { View = e => new Person() }, new EntitySettings <OrderEntity>() { View = e => new Order() }, }); QuerySettings.RegisterPropertyFormat((EmployeeEntity e) => e.Photo, b => { b.Converter = SouthwindConverters.ImageConverter; return(Fluent.GetDataTemplate(() => new Image { MaxHeight = 32.0, Stretch = Stretch.Uniform } .Bind(Image.SourceProperty, b) .Set(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.Linear))); }); //Photo QuerySettings.RegisterPropertyFormat((CategoryEntity e) => e.Picture, b => { b.Converter = SouthwindConverters.EmbeddedImageConverter; return(Fluent.GetDataTemplate(() => new Image { MaxHeight = 32.0, Stretch = Stretch.Uniform } .Bind(Image.SourceProperty, b) .Set(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.Linear))); }); //Picture Constructor.Register(ctx => new EmployeeEntity { Address = new AddressEntity() }); Constructor.Register(ctx => new PersonEntity { Address = new AddressEntity() }); Constructor.Register(ctx => new CompanyEntity { Address = new AddressEntity() }); Constructor.Register(ctx => new SupplierEntity { Address = new AddressEntity() }); OperationClient.AddSettings(new List <OperationSettings>() { new ConstructorOperationSettings <OrderEntity>(OrderOperation.Create) { Constructor = ctx => { var cust = Finder.Find <CustomerEntity>(); // could return null, but we let it continue return(OperationServer.Construct(OrderOperation.Create, cust)); }, }, new ContextualOperationSettings <ProductEntity>(OrderOperation.CreateOrderFromProducts) { Click = ctx => { var cust = Finder.Find <CustomerEntity>(); // could return null, but we let it continue var result = OperationServer.ConstructFromMany(ctx.Entities, OrderOperation.CreateOrderFromProducts, cust); Navigator.Navigate(result); }, }, new EntityOperationSettings <OrderEntity>(OrderOperation.SaveNew) { IsVisible = ctx => ctx.Entity.IsNew }, new EntityOperationSettings <OrderEntity>(OrderOperation.Save) { IsVisible = ctx => !ctx.Entity.IsNew }, new EntityOperationSettings <OrderEntity>(OrderOperation.Cancel) { ConfirmMessage = ctx => ((OrderEntity)ctx.Entity).State == OrderState.Shipped ? OrderMessage.CancelShippedOrder0.NiceToString(ctx.Entity) : null }, new EntityOperationSettings <OrderEntity>(OrderOperation.Ship) { Click = ctx => { DateTime shipDate = DateTime.Now; if (!ValueLineBox.Show(ref shipDate, labelText: DescriptionManager.NiceName((OrderEntity o) => o.ShippedDate), owner: Window.GetWindow(ctx.EntityControl))) { return(null); } try { return(ctx.Entity.Execute(OrderOperation.Ship, shipDate)); } catch (IntegrityCheckException e) { ctx.Entity.SetGraphErrors(e); throw e; } }, Contextual = { Click = ctx => { DateTime shipDate = DateTime.Now; if (!ValueLineBox.Show(ref shipDate, labelText: DescriptionManager.NiceName((OrderEntity o) => o.ShippedDate), owner: Window.GetWindow(ctx.SearchControl))) { return; } ctx.Entities.SingleEx().ExecuteLite(OrderOperation.Ship, shipDate); } } }, }); //NotDefined } }
public OpenSearchRequest Create(QuerySettings querySettings, NameValueCollection parameters) { return(openSearchable.Create(querySettings, parameters)); }
public QueryResult ExecuteContentQuery(string text, QuerySettings settings, params object[] parameters) { return(ContentQuery.Query(text, settings, parameters)); }
public OpenSearchRequest Create(QuerySettings querySettings, NameValueCollection parameters) { NameValueCollection nvc; if (url != null) nvc = HttpUtility.ParseQueryString(url.Query); else nvc = new NameValueCollection(); parameters.AllKeys.SingleOrDefault(k => { nvc.Set(k, parameters[k]); return false; }); return OpenSearchRequest.Create(this, querySettings, nvc); }
/// <summary> /// Builds the request URL for template. /// </summary> /// <returns>The request URL for template.</returns> /// <param name="remoteUrlTemplate">Remote URL template.</param> /// <param name="searchParameters">Search parameters.</param> /// <param name="urlTemplateDef">URL template def.</param> public static OpenSearchUrl BuildRequestUrlForTemplate(OpenSearchDescriptionUrl remoteUrlTemplate, NameValueCollection searchParameters, NameValueCollection requestUrlTemplateDef, QuerySettings querySettings) { // container for the final query url UriBuilder finalUrl = new UriBuilder(remoteUrlTemplate.Template); // parameters for final query NameValueCollection finalQueryParameters = new NameValueCollection(); // Parse the possible parameters of the remote url template NameValueCollection remoteParametersDef = HttpUtility.ParseQueryString(finalUrl.Query); // control duplicates foreach (string key in remoteParametersDef.AllKeys) { if (string.IsNullOrEmpty(key)) continue; int count = remoteParametersDef.GetValues(key).Count(); if (count > 1) { var value = remoteParametersDef.GetValues(key)[0]; remoteParametersDef.Remove(key); remoteParametersDef.Add(key, value); } } // For each parameter id set for search foreach (string parameter_id in searchParameters.AllKeys) { // skip if parameter is not in the template unless it is forced if (requestUrlTemplateDef[parameter_id] == null) { // if forced, set the param if (querySettings.ForceUnspecifiedParameters) { if (!(querySettings.SkipNullOrEmptyQueryStringParameters && string.IsNullOrEmpty(searchParameters[parameter_id]))) finalQueryParameters.Set(parameter_id, searchParameters[parameter_id]); } continue; } // first find the defintion of the parameter in the url template foreach (var key in requestUrlTemplateDef.GetValues(parameter_id)) { Match matchParamDef = Regex.Match(key, @"^{([^?]+)\??}$"); // If parameter is not respecting OpenSearch template spec, skip if (!matchParamDef.Success) continue; // We have the parameter defintion string paramDef = matchParamDef.Groups[1].Value; string paramValue = searchParameters[parameter_id]; // Find the paramdef in the remote URL template foreach (string keyDef in remoteParametersDef.AllKeys) { foreach (var key2 in remoteParametersDef.GetValues(keyDef)) { Match remoteMatchParamDef = Regex.Match(key2, @"^{(" + paramDef + @")\??}$"); // if match is successful if (remoteMatchParamDef.Success) { // then add the parameter with the right key if (!(querySettings.SkipNullOrEmptyQueryStringParameters && string.IsNullOrEmpty(paramValue))) finalQueryParameters.Set(keyDef, paramValue); } } } } } // All other remote query parameters foreach (string parameter in remoteParametersDef.AllKeys) { Match matchParamDef = Regex.Match(remoteParametersDef[parameter], @"^{([^?]+)\??}$"); // If parameter does not exist, continue if (!matchParamDef.Success && !string.IsNullOrEmpty(parameter)) { if (!(querySettings.SkipNullOrEmptyQueryStringParameters && string.IsNullOrEmpty(remoteParametersDef[parameter]))) finalQueryParameters.Set(parameter, remoteParametersDef[parameter]); } } //finalQueryParameters.Set("enableSourceproduct", "true"); string[] queryString = Array.ConvertAll(finalQueryParameters.AllKeys, key => string.Format("{0}={1}", key, HttpUtility.UrlEncode(finalQueryParameters[key]))); finalUrl.Query = string.Join("&", queryString); return new OpenSearchUrl(finalUrl.Uri); }
public QueryResult ExecuteContentQuery(string text, QuerySettings settings, params object[] parameters) { throw new NotSupportedException(); }
private async Task <ICollection <TModel> > GetAsync <TModel, TData>(string query, ODataQueryOptions <TModel> options = null, QuerySettings querySettings = null) where TModel : class where TData : class { return(await DoGet ( serviceProvider.GetRequiredService <IMapper>(), serviceProvider.GetRequiredService <MyDbContext>() )); async Task <ICollection <TModel> > DoGet(IMapper mapper, MyDbContext context) { return(await context.Set <TData>().GetAsync ( mapper, options ?? GetODataQueryOptions <TModel>(query), querySettings )); } }
public override QueryResult GetChildren(string text, QuerySettings settings, bool getAllChildren) { return(new QueryResult(_children)); }
private static void ExportContentTree(Content content, ExportContext context, string fsPath, string indent) { try { ExportContent(content, context, fsPath, indent); } catch (Exception ex) { LogException(ex); return; } //TODO: SmartFolder may contain real items too if (content.ContentHandler is SmartFolder) { return; } // create folder only if it has children var contentAsFolder = content.ContentHandler as IFolder; var contentAsGeneric = content.ContentHandler as GenericContent; // try everything that can have children (generic content, content types or other non-gc nodes) if (contentAsFolder == null && contentAsGeneric == null) { return; } try { var settings = new QuerySettings { EnableAutofilters = FilterStatus.Disabled, EnableLifespanFilter = FilterStatus.Disabled }; var queryResult = contentAsFolder == null?contentAsGeneric.GetChildren(settings) : contentAsFolder.GetChildren(settings); if (queryResult.Count == 0) { return; } var children = queryResult.Nodes; var fileName = GetSafeFileNameFromContentName(content.Name); var newDir = Path.Combine(fsPath, fileName); if (System.IO.File.Exists(newDir)) { newDir = Path.Combine(fsPath, fileName + ".Children"); } if (!(content.ContentHandler is ContentType)) { Directory.CreateDirectory(newDir); } var newIndent = indent + " "; foreach (var childContent in from node in children select Content.Create(node)) { ExportContentTree(childContent, context, newDir, newIndent); } } catch (Exception ex) { LogException(ex); } }
public static void GetSchema(string Database) { int StackPointer = Stack.Add($"Engines.GetSchema({Database})"); if (string.IsNullOrEmpty(Database))//Prevents Prevents Application from querying a nonexistent db { Stack.Exit(StackPointer); return; } EnginesMode EngineMode = Engine_Type(Database); switch (EngineMode) { case EnginesMode.SQLITE: _Tables.Clear(); _Views.Clear(); _Indexes.Clear(); QuerySettings QS = new QuerySettings { Database = Database, SQL = Sqlite.GetSchema(), FetchRecords = true, User = Language.Localization["App"], Explanation = "SCHEMA" }; Primitive Master_Schema_List = Query(QS); for (int i = 1; i <= Master_Schema_List.GetItemCount(); i++) { string Name = Master_Schema_List[i]["tbl_name"]; switch (Master_Schema_List[i]["type"].ToString()) { case "table": _Tables.Add(Name); break; case "view": _Views.Add(Name); break; case "index": _Indexes.Add(Name); break; } } break; } try { CurrentTable = _Tables.FirstOrDefault(); } catch (Exception ex) { Events.LogMessage(ex.ToString(), "System"); } _TrackingDefaultTable.Add(Database + "." + CurrentTable); if (Database != null && CurrentTable != null) { GetColumnsofTable(Database, CurrentTable); } _Views.Sort(); OnSchemaChange?.Invoke(null, EventArgs.Empty); Stack.Exit(StackPointer); }
private static BulkDeleteOperation GetBulkDeleteOperation(IOrganizationService service, Guid asyncId) { var settings = new QuerySettings<BulkDeleteOperation>() { ActiveOnly = false, Columns = new ColumnSet("failurecount", "successcount", "statecode", "statuscode", "bulkdeleteoperationid", "asyncoperationid"), First = true }; return service.RetrieveList<BulkDeleteOperation>(settings.CreateExpression("asyncoperationid", asyncId)).FirstOrDefault(); }
public ConnectionProvider(IOptions <QuerySettings> querySettings) { this._querySettings = querySettings.Value; }
/// <summary> /// Create an OpenSearchRequest based on the IOpenSearchable entity, type and parameters. /// </summary> /// <description> /// This method is the basic default implementation for creating OpenSearchRequest. It supports only 2 schemes: /// 1) file:// that will create a FileOpenSearchRequest /// 2) http:// that will create an HttpOpenSearchRequest /// <param name="entity">IOpenSearchable Entity.</param> /// <param name="type">MimeType of the request.</param> /// <param name="parameters">Parameters of the request.</param> public static OpenSearchRequest Create(IOpenSearchable entity, QuerySettings querySettings, NameValueCollection parameters) { OpenSearchDescription osd = entity.GetOpenSearchDescription(); OpenSearchDescriptionUrl url = OpenSearchFactory.GetOpenSearchUrlByType(osd, querySettings.PreferredContentType); if (url == null) throw new InvalidOperationException(string.Format("Could not find a URL template for entity {0} with type {1}", entity.Identifier, querySettings.PreferredContentType)); OpenSearchUrl queryUrl = OpenSearchFactory.BuildRequestUrlForTemplate(url, parameters, entity.GetOpenSearchParameters(querySettings.PreferredContentType), querySettings); OpenSearchRequest request = null; switch (queryUrl.Scheme) { case "http": case "https": request = new HttpOpenSearchRequest(queryUrl, querySettings.PreferredContentType); ((HttpOpenSearchRequest)request).TimeOut = 60000; break; case "file": request = new FileOpenSearchRequest(queryUrl, querySettings.PreferredContentType); break; } request.OriginalParameters = parameters; return request; }
public PageResponse <CandidateSchoolDTO> Get(QuerySettings settings) { return(_service.Get(settings)); }
/// <summary> /// Initializes a new instance of the SnQueryContext. /// </summary> public SnQueryContext(QuerySettings settings, int userId) { Settings = settings ?? QuerySettings.Default; UserId = userId; }
public static LucQuery BuildQuery(System.Linq.Expressions.Expression expression, Type sourceCollectionItemType, string contextPath, QuerySettings settings) { var childrenDef = new ChildrenDefinition { PathUsage = PathUsageMode.InFolderAnd, Top = settings.Top, Skip = settings.Skip, Sort = settings.Sort, EnableAutofilters = settings.EnableAutofilters, EnableLifespanFilter = settings.EnableLifespanFilter }; return(BuildLucQuery(expression, sourceCollectionItemType, contextPath, childrenDef)); }
public OpenSearchRequest Create(QuerySettings querySettings, NameValueCollection parameters) { OpenSearchUrl url = GetInternalOpenSearchUrl(parameters); return new MultiOpenSearchRequest<AtomFeed, AtomItem>(ose, entities.ToArray(), querySettings.PreferredContentType, url, concurrent, this); }
/// <summary> /// TODO: Refactor /// </summary> internal static void CaptureMetadata(StructuredQuery query, QuerySettings settings, QueryResult result, DataTable dataTable) { if (settings.SupportClientAggregate) { int totalGroupedColumns = settings.ClientAggregate.GroupedColumns?.Count ?? 0; int totalColumns = totalGroupedColumns + settings.ClientAggregate.AggregatedColumns.Count; for (int index = 0; index < totalColumns; index++) { int columnIndex; DataColumn tableColumn = dataTable.Columns[index]; if (index < totalGroupedColumns) { columnIndex = index; if (settings.ClientAggregate.GroupedColumns != null) { tableColumn.ExtendedProperties["ColumnId"] = settings.ClientAggregate.GroupedColumns[columnIndex].ReportColumnId; } } else { columnIndex = index - totalGroupedColumns; if (settings.ClientAggregate.AggregatedColumns != null) { tableColumn.ExtendedProperties["ColumnId"] = settings.ClientAggregate.AggregatedColumns[columnIndex].ReportColumnId; } } tableColumn.ExtendedProperties["ColumnIndex"] = columnIndex; } result.AggregateDataTable = dataTable; } else { int index = 0; foreach (SelectColumn selectColumn in query.SelectColumns) { // Set column ID into data table column object (why??) DataColumn tableColumn = dataTable.Columns[index]; tableColumn.ExtendedProperties["ColumnId"] = selectColumn.ColumnId; // Set data type into result column info, for columns (e.g. calculated) where we can only determine it dynamically at the moment ResultColumn resultColumn = result.Columns[index]; if (resultColumn.ColumnType == null) { if (selectColumn.Expression is AggregateExpression && ((AggregateExpression)selectColumn.Expression).Expression is ResourceExpression) { if (((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.Count || ((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.CountUniqueItems || ((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.CountUniqueNotBlanks || ((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.CountWithValues) { resultColumn.ColumnType = new EDC.Database.Types.Int32Type(); } else { resultColumn.ColumnType = ((ResourceExpression)((AggregateExpression)selectColumn.Expression).Expression).CastType; resultColumn.IsResource = true; if (resultColumn.ColumnType == null) { resultColumn.ColumnType = new EDC.Database.Types.ChoiceRelationshipType(); } } } else if (selectColumn.Expression is AggregateExpression && ((AggregateExpression)selectColumn.Expression).Expression is ResourceDataColumn) { if (((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.Count || ((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.CountUniqueItems || ((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.CountUniqueNotBlanks || ((AggregateExpression)selectColumn.Expression).AggregateMethod == AggregateMethod.CountWithValues) { resultColumn.ColumnType = new EDC.Database.Types.Int32Type(); } else { resultColumn.ColumnType = ((ResourceDataColumn)((AggregateExpression)selectColumn.Expression).Expression).CastType; //resultColumn.IsResource = true; } } else if (selectColumn.Expression is StructureViewExpression) { resultColumn.ColumnType = new EDC.Database.Types.StructureLevelsType(); } else { ResourceExpression resourceExpression = selectColumn.Expression as ResourceExpression; if (resourceExpression != null) { resultColumn.ColumnType = resourceExpression.CastType; resultColumn.IsResource = true; } else { resultColumn.ColumnType = DatabaseType.ConvertFromType(tableColumn.DataType); } } } index++; } result.DataTable = dataTable; } }