private static SimulatorSettings GetValidSimulatorSettings(FilterSetting filter) { return(new() { Topics = new[] { new TopicSettings { Key = "TopicKey", Name = "TopicName", Port = 12345, Subscribers = new List <SubscriptionSettings> { new() { Name = "SubscriberName", Filter = filter } }.ToArray()
public static FilterSetting GetFilterSetting <T>(Expression <Func <T, object> > exp, FilterOperator?defaultOperator = null) { var expStr = exp.Body.ToString().Replace("Convert(", "").Replace(", Object)", ""); var x = Expression.Parameter(typeof(T), "x"); var properties = expStr.Split('.'); var property = Expression.Property(x, properties[1]); for (var i = 2; i < properties.Length; i++) { property = Expression.Property(property, properties[i]); } var fs = new FilterSetting(property, x) { ModelName = typeof(T).Name, DefaultOperator = defaultOperator }; return(fs); }
public void TestSimpleEventDataFilteringUsingValueSuccess() { var filterConfig = new FilterSetting { AdvancedFilters = new[] { new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.OperatorTypeEnum.NumberGreaterThanOrEquals, Value = 1 }, new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.OperatorTypeEnum.NumberLessThanOrEquals, Value = 1 } } }; var gridEvent = new EventGridEvent { Data = 1 }; filterConfig.AcceptsEvent(gridEvent).ShouldBeTrue(); }
public void TestStartsWithOperatorString() { const string f = "f"; var source = new[] { new TestSource {String = "foo", Int = 1}, new TestSource {String = "bar", Int = 2}, new TestSource {String = "baz", Int = 3}, new TestSource {String = "fii", Int = 4}, new TestSource {String = "fuu", Int = 5}, new TestSource {String = "zap", Int = 6}, new TestSource {String = "faa", Int = 7} }; var expectedResultList = source.Where(t => t.String.StartsWith(f)).ToList(); var filter = new FilterSetting { OperatorName = FilterOperators.StartsWithOperator, PropertyPath = "String", Value = f }; var result = _builder.Filter(source.AsQueryable(), new[] { filter }); TestUtil.AssertModels(expectedResultList, result.ToList()); }
public void Projections_Filter() { CombinatorialEngine engine = CombinatorialEngine.FromDimensions( new Dimension("DataServiceType", new Type[] { typeof(CustomDataContext), typeof(ocs.CustomObjectContext), typeof(CustomRowBasedContext), typeof(CustomRowBasedOpenTypesContext) }), new Dimension("Format", UnitTestsUtil.ResponseFormats)); using (TestUtil.MetadataCacheCleaner()) using (ocs.PopulateData.CreateTableAndPopulateData()) using (TestWebRequest request = TestWebRequest.CreateForInProcess()) { TestUtil.RunCombinatorialEngineFail(engine, values => { request.DataServiceType = (Type)values["DataServiceType"]; request.Accept = (string)values["Format"]; TestUtil.RunCombinatorialEngineFail(CombinatorialEngine.FromDimensions( new Dimension("Filter", new FilterSetting[] { new FilterSetting("ID eq 1", 1), new FilterSetting("ID gt 0", 1, 2), new FilterSetting("length(Name) sub ID gt 9", 0), new FilterSetting("BestFriend/ID eq 1", 2), new FilterSetting("2 sub BestFriend/BestFriend/ID gt 0", 2) }), new Dimension("Select", CustomerSelects)), values2 => { FilterSetting filter = (FilterSetting)values2["Filter"]; SelectDescription select = (SelectDescription)values2["Select"]; VerifyEntryIDsAndXPaths( "/Customers?$select=" + select.Select + "&$filter=" + filter.Filter, request, filter.FilteredIDs, select.VerificationXPaths); }); VerifyEntryIDsAndXPaths("/Customers(1)/Orders?$select=DollarAmount&$filter=ID gt 1", request, new int[] { 101 }); VerifyEntryIDsAndXPaths( "/Customers?$select=BestFriend&$expand=BestFriend($select=ID)&$filter=ID gt 0&$orderby=BestFriend/ID desc", request, new int[] { 2, 1 }); }); } }
private SimulatorSettings GetValidSimulatorSettings(FilterSetting filter) { return(new SimulatorSettings { Topics = new[] { new TopicSettings { Key = "TopicKey", Name = "TopicName", Port = 12345, Subscribers = new List <SubscriptionSettings> { new SubscriptionSettings { Filter = filter } } } } }); }
/// <summary> /// Gets the items. /// </summary> /// <param name="filterSetting">The filter setting.</param> /// <returns></returns> public IList <NuspecInfo> GetItems(FilterSetting filterSetting) { var result = new List <NuspecInfo>(); if (Directory.Exists(filterSetting.RootDir)) { var folders = Directory.GetDirectories(filterSetting.RootDir, "*", SearchOption.TopDirectoryOnly); foreach (var folder in folders) { var files = Directory.GetFiles(folder, filterSetting.NugetFilter, SearchOption.AllDirectories); if (files.Any()) { result.AddRange(this.BuildNugetInfo(files)); } } return(result); } return(result); }
public async Task <IActionResult> Create([Bind("Id,CrawlUrl,ExcludeWord,IgnoreCompany,MinimumWage,MaximumWage,Remarks")] FilterSetting filterSetting) { try { // 調用 SettingService 提供的函數來建立設定檔,若中途出錯則跳轉到指定的錯誤頁面 string ErrorMessage = SettingService.CreateSetting(_context, filterSetting, User.Identity.Name); if (ErrorMessage != null) { ViewBag.Error = ErrorMessage; return(View("~/Views/Shared/ErrorPage.cshtml")); } // 若中途沒有出錯則寫入變更到DB,並跳轉回設定檔列表 await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } catch (Exception) { ViewBag.Error = "系統忙碌中,請稍後再試 >___<"; return(View("~/Views/Shared/ErrorPage.cshtml")); } }
public static JobList GetValidJobs(FilterSetting filterSetting) { // 創建多個爬蟲(其數量不超過 NumberOfLogicalProcessors) string TargetUrl = filterSetting.CrawlUrl; char ConnectionChar = TargetUrl.Last() == '/' ? '?' : '&'; List <JobCrawler> JobCrawlers = new List <JobCrawler> { new JobCrawler($"{TargetUrl}{ConnectionChar}page=1"), new JobCrawler($"{TargetUrl}{ConnectionChar}page=2"), new JobCrawler($"{TargetUrl}{ConnectionChar}page=3"), new JobCrawler($"{TargetUrl}{ConnectionChar}page=4"), new JobCrawler($"{TargetUrl}{ConnectionChar}page=5"), new JobCrawler($"{TargetUrl}{ConnectionChar}page=6"), }; // 令爬蟲們抓取頁面 & 取得工作列表 GetTargetPages(JobCrawlers); GetJobSections(JobCrawlers); // 根據設定檔來過濾每一隻爬蟲所擁有的工作列表 JobList validJobs = new JobList(); foreach (JobCrawler jobCrawler in JobCrawlers) { if (!jobCrawler.IsEncounterError()) { foreach (Job job in jobCrawler.GetJobs()) { if (IsValidJob(filterSetting, job)) { validJobs.Add(job); } } } } return(validJobs); }
public object Clone() { var filterSetting = new FilterSetting { Id = Id, Name = Name, IsDefault = IsDefault, FilterDateUsed = FilterDateUsed, FilterDate = (FilterDate)FilterDate.Clone(), FilterNamesInclude = FilterNamesInclude, FilterNamesExclude = FilterNamesExclude, UseRegularExpressionMatching = UseRegularExpressionMatching, FilterAttributeArchiveUsed = FilterAttributeArchiveUsed, FilterAttributeAchiveType = FilterAttributeAchiveType, FilterAttributeSystemUsed = FilterAttributeSystemUsed, FilterAttributeSystemType = FilterAttributeSystemType, FilterAttributeHiddenUsed = FilterAttributeHiddenUsed, FilterAttributeHiddenType = FilterAttributeHiddenType, FilterAttributeReadOnlyUsed = FilterAttributeReadOnlyUsed, FilterAttributeReadOnlyType = FilterAttributeReadOnlyType }; return(filterSetting); }
/// <summary> /// List filtered NameValuePairs sorted by value /// </summary> public IList <NameValuePair> SortByValue(FilterSetting setting = null) { return(SortBy(setting, (NameValuePair x) => x.Value)); }
public IList <NameValuePair> SortBy(FilterSetting setting, Func <NameValuePair, string> command) { return(PrepareFilterQuery(setting).OrderBy(command).ToList()); }
/// <summary> /// List filtered NameValuePairs /// </summary> public IList <NameValuePair> Filter(FilterSetting setting) { return(PrepareFilterQuery(setting).ToList()); }
public IList <NameValuePair> Filter(FilterSetting setting) { FilterSetting = setting; return(Repository.Filter(FilterSetting)); }
public void TestPropertyPathFilteringWithNullCheck() { const string foo = "foo"; var source = new[] { new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "foo", Int = 1}}}, new TestSource{ Inner = new InnerType{Complex = new TestSource {String = null, Int = 2}}},//Final property is null new TestSource{ Inner = new InnerType{Complex = null}}, //Null in between new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "foo", Int = 4}}}, new TestSource{ Inner = null}, //Null in between null,//Whole item is null new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "foo", Int = 7}}} }; var expectedResultList = source.AsQueryable().Where(t => t != null && t.Inner != null && t.Inner.Complex != null && t.Inner.Complex.String == foo); var filter = new FilterSetting { OperatorName = FilterOperators.EqualsOperator, PropertyPath = "Inner.Complex.String", Value = foo }; var result = _builder.Filter(source.AsQueryable(), new[] { filter }); TestUtil.AssertModels(expectedResultList.ToList(), result.ToList()); }
public void TestOrAndCombination() { var source = new[] { new TestSource {String = "foo", Int = 1}, new TestSource {String = "bar", Int = 2}, new TestSource {String = "baz", Int = 3}, new TestSource {String = "fii", Int = 4}, new TestSource {String = "baz", Int = 5}, new TestSource {String = "fuu", Int = 6}, new TestSource {String = "zap", Int = 7}, new TestSource {String = "faa", Int = 8} }; var expectedResultList = source.Where(t => t.String.StartsWith("f") && (t.String.EndsWith("i") || t.String.EndsWith("a"))).ToList(); var startsWithFilter = new FilterSetting { OperatorName = FilterOperators.StartsWithOperator, PropertyPath = "String", Value = "f" }; var endsWith1Filter = new FilterSetting { OperatorName = FilterOperators.EndsWithOperator, PropertyPath = "String", Value = "i" }; var endsWith2Filter = new FilterSetting { OperatorName = FilterOperators.EndsWithOperator, PropertyPath = "String", Value = "a" }; var orFilter = new FilterSetting { OrConnectedFilters = new List<FilterSetting> { endsWith1Filter, endsWith2Filter } }; var result = _builder.Filter(source.AsQueryable(), new[] { startsWithFilter, orFilter }); TestUtil.AssertModels(expectedResultList, result.ToList()); }
public void TestInOperatorEnumerale() { var value = new[] {"foo", "baz"}; var source = new[] { new TestSource {String = "foo", Int = 1}, new TestSource {String = "bar", Int = 2}, new TestSource {String = "baz", Int = 3}, new TestSource {String = "fii", Int = 4}, new TestSource {String = "baz", Int = 5}, new TestSource {String = "fuu", Int = 6}, new TestSource {String = "zap", Int = 7} }; var expectedResultList = source.Where(t => value.Contains(t.String)).ToList(); var filter = new FilterSetting { OperatorName = FilterOperators.InOperator, PropertyPath = "String", Value = value }; var result = _builder.Filter(source.AsQueryable(), new[] { filter }); TestUtil.AssertModels(expectedResultList, result.ToList()); }
public static Expression <Func <T, bool> > CreateFilter <T>(FilterSetting filterSetting, FieldFilter field, ref Type valueType, bool toSql = true) where T : class { var propertyName = filterSetting.FieldName; var property = filterSetting.Field(); var parameter = filterSetting.Parameter(); Type type = typeof(T); if (property == null) { parameter = Expression.Parameter(type, "x"); var properties = propertyName.Split('.'); property = Expression.Property(parameter, properties[0]); for (var i = 1; i < properties.Length; i++) { property = Expression.Property(property, properties[i]); } } Expression q = null; FieldFilterMethod m = null; if (valueType == null) { valueType = property.Type; } if (field.Operator == FilterOperator.In) { if (valueType == typeof(int)) { m = _FieldFilterMethods["List<int>"]; q = Expression.Call(Expression.Constant(field.Value.GetIntList(0), m.ValueType), m.Method ?? throw new InvalidOperationException(), property); } else if (valueType == typeof(int?)) { m = _FieldFilterMethods["List<int?>"]; q = Expression.Call(Expression.Constant(field.Value.GetNullableIntList(), m.ValueType), m.Method ?? throw new InvalidOperationException(), property); } else if (valueType == typeof(string)) { m = _FieldFilterMethods["List<string>"]; q = Expression.Call(Expression.Constant(field.Value.Split(',').ToList(), m.ValueType), m.Method ?? throw new InvalidOperationException(), property); } } else { var parsedValue = _ParseValue(filterSetting, field.Value, valueType); switch (field.Operator) { case FilterOperator.Gt: q = Expression.GreaterThan(property, Expression.Constant(parsedValue, valueType)); break; case FilterOperator.Lt: q = Expression.LessThan(property, Expression.Constant(parsedValue, valueType)); break; case FilterOperator.Eq: q = Expression.Equal(property, Expression.Constant(parsedValue, valueType)); break; case FilterOperator.Le: q = Expression.LessThanOrEqual(property, Expression.Constant(parsedValue, valueType)); break; case FilterOperator.Ge: q = Expression.GreaterThanOrEqual(property, Expression.Constant(parsedValue, valueType)); break; case FilterOperator.Ne: q = Expression.NotEqual(property, Expression.Constant(parsedValue, valueType)); break; case FilterOperator.Contains: if (toSql) { m = _FieldFilterMethods["Contains"]; q = Expression.Call(property, m.Method ?? throw new InvalidOperationException(), Expression.Constant(parsedValue, m.ValueType)); } else { m = _FieldFilterMethods["iContains"]; q = Expression.Call(m.Method ?? throw new InvalidOperationException(), property, Expression.Constant(parsedValue, m.ValueType)); } break; case FilterOperator.StartsWith: if (toSql) { m = _FieldFilterMethods["StartsWith"]; q = Expression.Call(property, m.Method ?? throw new InvalidOperationException(), Expression.Constant(parsedValue, m.ValueType)); } else { m = _FieldFilterMethods["iStartsWith"]; q = Expression.Call(m.Method ?? throw new InvalidOperationException(), property, Expression.Constant(parsedValue, m.ValueType)); } break; case FilterOperator.EndsWith: if (toSql) { m = _FieldFilterMethods["EndsWith"]; q = Expression.Call(property, m.Method ?? throw new InvalidOperationException(), Expression.Constant(parsedValue, m.ValueType)); } else { m = _FieldFilterMethods["iEndsWith"]; q = Expression.Call(m.Method ?? throw new InvalidOperationException(), property, Expression.Constant(parsedValue, m.ValueType)); } break; } } if (q == null) { throw new Exception($"Filter operator `{field.Operator}` with type `{valueType}` is not supported yet."); } if (field.Not) { return(Expression.Lambda <Func <T, bool> >(Expression.Not(q), parameter)); } else { return(Expression.Lambda <Func <T, bool> >(q, parameter)); } }
internal IEnumerable <AttributeMetadata> GetDisplayAttributes(string entityName, FilterSetting selectedfilter, ShowMetaTypesAttribute selectattributes) { var result = new List <AttributeMetadata>(); var entity = GetEntity(entityName); if (entity == null) { return(result); } if (solutionentities == null || solutionentities.Count == 0) { LoadSolutionsComponents(selectedfilter); } var includeall = solutionentities .Where(se => se.GetAttributeValue <Guid>("objectid").Equals(entity.MetadataId)) .Any(se => se.GetAttributeValue <OptionSetValue>("rootcomponentbehavior").Value == 0); var attributes = GetAllAttribues(entityName); foreach (var attribute in attributes) { if (selectedfilter.AlwaysPrimary && attribute.IsLogical != true && (attribute.IsPrimaryId == true || attribute.IsPrimaryName == true)) { result.Add(attribute); continue; } if (selectedfilter.AlwaysAddresses && attribute.IsLogical == true && attribute.AttributeType != AttributeTypeCode.Virtual && attribute.LogicalName.StartsWith("address")) { result.Add(attribute); continue; } if (!selectedfilter.ShowAllSolutions && !includeall && !solutionattributes.Contains((Guid)attribute.MetadataId)) { continue; } if (selectedfilter.FilterByMetadata) { if (!CheckMetadata(selectattributes.IsManaged, attribute.IsManaged)) { continue; } if (!CheckMetadata(selectattributes.IsCustom, attribute.IsCustomAttribute)) { continue; } if (!CheckMetadata(selectattributes.IsCustomizable, attribute.IsCustomizable)) { continue; } if (!CheckMetadata(selectattributes.IsValidForAdvancedFind, attribute.IsValidForAdvancedFind)) { continue; } if (!CheckMetadata(selectattributes.IsAuditEnabled, attribute.IsAuditEnabled)) { continue; } if (!CheckMetadata(selectattributes.IsLogical, attribute.IsLogical)) { continue; } if (!CheckMetadata(selectattributes.IsValidForRead, attribute.IsValidForRead)) { continue; } if (!CheckMetadata(selectattributes.IsValidForGrid, attribute.IsValidForGrid)) { continue; } if (!CheckMetadata(selectattributes.IsFiltered, attribute.IsFilterable)) { continue; } if (!CheckMetadata(selectattributes.IsRetrievable, attribute.IsRetrievable)) { continue; } if (!CheckMetadata(selectattributes.AttributeOf, !string.IsNullOrEmpty(attribute.AttributeOf))) { continue; } if (!CheckMetadata(selectattributes.CalculationOf, attribute is MoneyAttributeMetadata money ? !string.IsNullOrEmpty(money.CalculationOf) : false)) { continue; } } result.Add(attribute); } return(result); }
internal List <EntityMetadata> GetDisplayEntities(FilterSetting selectedfilter, ShowMetaTypesEntity selectentities) { var result = new List <EntityMetadata>(); if (entities == null || selectedfilter.NoneEntitiesSelected) { return(result); } if (solutionentities == null || solutionentities.Count == 0) { LoadSolutionsComponents(selectedfilter); } foreach (var entity in entities.Where(e => selectedfilter.ShowAllSolutions || solutionentities.Select(se => se["objectid"]).Contains((Guid)e.MetadataId))) { if (selectedfilter.FilterByMetadata) { if (!CheckMetadata(selectentities.IsManaged, entity.IsManaged)) { continue; } if (!CheckMetadata(selectentities.IsCustom, entity.IsCustomEntity)) { continue; } if (!CheckMetadata(selectentities.IsCustomizable, entity.IsCustomizable)) { continue; } if (!CheckMetadata(selectentities.IsValidForAdvancedFind, entity.IsValidForAdvancedFind)) { continue; } if (!CheckMetadata(selectentities.IsAuditEnabled, entity.IsAuditEnabled)) { continue; } if (!CheckMetadata(selectentities.IsLogical, entity.IsLogicalEntity)) { continue; } if (!CheckMetadata(selectentities.IsIntersect, entity.IsIntersect)) { continue; } if (!CheckMetadata(selectentities.IsActivity, entity.IsActivity)) { continue; } if (!CheckMetadata(selectentities.IsActivityParty, entity.IsActivityParty)) { continue; } if (!CheckMetadata(selectentities.Virtual, entity.DataProviderId.HasValue)) { continue; } if (!CheckMetadata(selectentities.Ownerships, entity.OwnershipType)) { continue; } } result.Add(entity); } return(result); }
public FilterAttribute(int firstColumn, int?lastColumn) { FilterSetting = new FilterSetting(firstColumn, lastColumn); }
private string GetFilterCondition() { string filter = string.Empty; if (this.DataSet.Tables[0].ExtendedProperties.ContainsKey(TableProperty.FilterSetting)) { FilterSetting filterSetting = this.DataSet.Tables[0].ExtendedProperties[TableProperty.FilterSetting] as FilterSetting; if (filterSetting != null) { DataTable table = this.DataSet.Tables[0]; if (table.Columns.Contains(filterSetting.Name)) { if (table.Columns[filterSetting.Name].ExtendedProperties.ContainsKey(FieldProperty.ControlType)) { //TODO需考虑节假日的情况,例如周五看到明天的数据,应该是看到周一的数据 LibControlType controlType = (LibControlType)table.Columns[filterSetting.Name].ExtendedProperties[FieldProperty.ControlType]; if (controlType == LibControlType.Date) { int currentDate = LibDateUtils.GetCurrentDate(); if (filterSetting.Day == 0) { filter = string.Format("A.{0} = {1}", filterSetting.Name, currentDate); } else { int otherDate = LibDateUtils.AddDayToLibDate(currentDate, filterSetting.Day); if (currentDate < otherDate) { filter = string.Format("A.{0} >= {1} and A.{0} <= {2}", filterSetting.Name, currentDate, otherDate); } else { filter = string.Format("A.{0} >= {1} and A.{0} <= {2}", filterSetting.Name, otherDate, currentDate); } } } else if (controlType == LibControlType.DateTime) { int currentDate = LibDateUtils.GetCurrentDate(); if (filterSetting.Day == 0) { filter = string.Format("A.{0} >= {1}000000 and A.{0}<={2}999999", filterSetting.Name, currentDate); } else { int otherDate = LibDateUtils.AddDayToLibDate(currentDate, filterSetting.Day); if (currentDate < otherDate) { filter = string.Format("A.{0} >= {1}000000 and A.{0} <= {2}999999", filterSetting.Name, currentDate, otherDate); } else { filter = string.Format("A.{0} >= {1}000000 and A.{0} <= {2}999999", filterSetting.Name, otherDate, currentDate); } } } } } } } return(filter); }
public Verifier(FilterSetting filterSetting, Job job, bool valid) { _filterSetting = filterSetting; _job = job; _valid = valid; }
public IExcelConfiguration HasFilter(int firstColumn, int?lastColumn) { FilterSetting = new FilterSetting(firstColumn, lastColumn); return(this); }
private Program() { var databaseOptions = smugglerApi.Options; var filesOptions = smugglerFilesApi.Options; selectionDispatching = new OptionSet(); selectionDispatching.Add("d|d2|database|database2:", OptionCategory.None, string.Empty, value => { if (mode == SmugglerMode.Unknown || mode == SmugglerMode.Database) { mode = SmugglerMode.Database; } else { PrintUsageAndExit(new ArgumentException("Database and Filesystem parameters are mixed. You cannot use both in the same request.")); } }); selectionDispatching.Add("f|f2|filesystem|filesystem2:", OptionCategory.None, string.Empty, value => { if (mode == SmugglerMode.Unknown || mode == SmugglerMode.Filesystem) { mode = SmugglerMode.Filesystem; } else { PrintUsageAndExit(new ArgumentException("Database and Filesystem parameters are mixed. You cannot use both in the same request.")); } }); databaseOptionSet = new OptionSet(); databaseOptionSet.Add("operate-on-types:", OptionCategory.SmugglerDatabase, "Specify the types to operate on. Specify the types to operate on. You can specify more than one type by combining items with a comma." + Environment.NewLine + "Default is all items." + Environment.NewLine + "Usage example: Indexes,Documents,Attachments", value => { try { if (string.IsNullOrWhiteSpace(value) == false) { databaseOptions.OperateOnTypes = (ItemType)Enum.Parse(typeof(ItemType), value, ignoreCase: true); } } catch (Exception e) { PrintUsageAndExit(e); } }); databaseOptionSet.Add("metadata-filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents by a metadata property." + Environment.NewLine + "Usage example: Raven-Entity-Name=Posts, or Raven-Entity-Name=Posts,Persons for multiple document types", (key, val) => databaseOptions.Filters.Add(new FilterSetting { Path = "@metadata." + key, ShouldMatch = true, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("negative-metadata-filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents NOT matching a metadata property." + Environment.NewLine + "Usage example: Raven-Entity-Name=Posts", (key, val) => databaseOptions.Filters.Add( new FilterSetting { Path = "@metadata." + key, ShouldMatch = false, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents by a document property" + Environment.NewLine + "Usage example: Property-Name=Value", (key, val) => databaseOptions.Filters.Add( new FilterSetting { Path = key, ShouldMatch = true, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("negative-filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents NOT matching a document property" + Environment.NewLine + "Usage example: Property-Name=Value", (key, val) => databaseOptions.Filters.Add( new FilterSetting { Path = key, ShouldMatch = false, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("transform:", OptionCategory.SmugglerDatabase, "Transform documents using a given script (import only)", script => databaseOptions.TransformScript = script); databaseOptionSet.Add("transform-file:", OptionCategory.SmugglerDatabase, "Transform documents using a given script file (import only)", script => databaseOptions.TransformScript = File.ReadAllText(script)); databaseOptionSet.Add("max-steps-for-transform-script:", OptionCategory.SmugglerDatabase, "Maximum number of steps that transform script can have (import only)", s => databaseOptions.MaxStepsForTransformScript = int.Parse(s)); databaseOptionSet.Add("batch-size:", OptionCategory.SmugglerDatabase, "The batch size for requests", s => databaseOptions.BatchSize = int.Parse(s)); databaseOptionSet.Add("chunk-size:", OptionCategory.SmugglerDatabase, "The number of documents to import before new connection will be opened", s => databaseOptions.ChunkSize = int.Parse(s)); databaseOptionSet.Add("d|database:", OptionCategory.SmugglerDatabase, "The database to operate on. If no specified, the operations will be on the default database.", value => databaseOptions.Source.DefaultDatabase = value); databaseOptionSet.Add("d2|database2:", OptionCategory.SmugglerDatabase, "The database to export to. If no specified, the operations will be on the default database. This parameter is used only in the between operation.", value => databaseOptions.Destination.DefaultDatabase = value); databaseOptionSet.Add("wait-for-indexing", OptionCategory.SmugglerDatabase, "Wait until all indexing activity has been completed (import only)", _ => databaseOptions.WaitForIndexing = true); databaseOptionSet.Add("excludeexpired", OptionCategory.SmugglerDatabase, "Excludes expired documents created by the expiration bundle", _ => databaseOptions.ShouldExcludeExpired = true); databaseOptionSet.Add("limit:", OptionCategory.SmugglerDatabase, "Reads at most VALUE documents/attachments.", s => databaseOptions.Limit = int.Parse(s)); databaseOptionSet.Add("timeout:", OptionCategory.SmugglerDatabase, "The timeout to use for requests", s => databaseOptions.Timeout = TimeSpan.FromMilliseconds(int.Parse(s))); databaseOptionSet.Add("incremental", OptionCategory.SmugglerDatabase, "States usage of incremental operations", _ => databaseOptions.Incremental = true); databaseOptionSet.Add("u|user|username:"******"The username to use when the database requires the client to authenticate.", value => GetCredentials(databaseOptions.Source).UserName = value); databaseOptionSet.Add("u2|user2|username2:", OptionCategory.SmugglerDatabase, "The username to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(databaseOptions.Destination).UserName = value); databaseOptionSet.Add("p|pass|password:"******"The password to use when the database requires the client to authenticate.", value => GetCredentials(databaseOptions.Source).Password = value); databaseOptionSet.Add("p2|pass2|password2:", OptionCategory.SmugglerDatabase, "The password to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(databaseOptions.Destination).Password = value); databaseOptionSet.Add("domain:", OptionCategory.SmugglerDatabase, "The domain to use when the database requires the client to authenticate.", value => GetCredentials(databaseOptions.Source).Domain = value); databaseOptionSet.Add("domain2:", OptionCategory.SmugglerDatabase, "The domain to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(databaseOptions.Destination).Domain = value); databaseOptionSet.Add("key|api-key|apikey:", OptionCategory.SmugglerDatabase, "The API-key to use, when using OAuth.", value => databaseOptions.Source.ApiKey = value); databaseOptionSet.Add("key2|api-key2|apikey2:", OptionCategory.SmugglerDatabase, "The API-key to use, when using OAuth. This parameter is used only in the between operation.", value => databaseOptions.Destination.ApiKey = value); databaseOptionSet.Add("strip-replication-information", OptionCategory.SmugglerDatabase, "Remove all replication information from metadata (import only)", _ => databaseOptions.StripReplicationInformation = true); databaseOptionSet.Add("continuation-token:", OptionCategory.SmugglerDatabase, "Activates the usage of a continuation token in case of unreliable connections or huge imports", s => databaseOptions.ContinuationToken = s); databaseOptionSet.Add("skip-conflicted", OptionCategory.SmugglerDatabase, "The database will issue and error when conflicted documents are put. The default is to alert the user, this allows to skip them to continue.", _ => databaseOptions.SkipConflicted = true); filesystemOptionSet = new OptionSet(); filesystemOptionSet.Add("timeout:", OptionCategory.SmugglerFileSystem, "The timeout to use for requests", s => filesOptions.Timeout = TimeSpan.FromMilliseconds(int.Parse(s))); filesystemOptionSet.Add("incremental", OptionCategory.SmugglerFileSystem, "States usage of incremental operations", _ => filesOptions.Incremental = true); filesystemOptionSet.Add("u|user|username:"******"The username to use when the filesystem requires the client to authenticate.", value => GetCredentials(filesOptions.Source).UserName = value); filesystemOptionSet.Add("u2|user2|username2:", OptionCategory.SmugglerFileSystem, "The username to use when the filesystem requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(filesOptions.Destination).UserName = value); filesystemOptionSet.Add("p|pass|password:"******"The password to use when the filesystem requires the client to authenticate.", value => GetCredentials(filesOptions.Source).Password = value); filesystemOptionSet.Add("p2|pass2|password2:", OptionCategory.SmugglerFileSystem, "The password to use when the filesystem requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(filesOptions.Destination).Password = value); filesystemOptionSet.Add("domain:", OptionCategory.SmugglerFileSystem, "The domain to use when the filesystem requires the client to authenticate.", value => GetCredentials(filesOptions.Source).Domain = value); filesystemOptionSet.Add("domain2:", OptionCategory.SmugglerFileSystem, "The domain to use when the filesystem requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(filesOptions.Destination).Domain = value); filesystemOptionSet.Add("key|api-key|apikey:", OptionCategory.SmugglerFileSystem, "The API-key to use, when using OAuth.", value => filesOptions.Source.ApiKey = value); filesystemOptionSet.Add("key2|api-key2|apikey2:", OptionCategory.SmugglerFileSystem, "The API-key to use, when using OAuth. This parameter is used only in the between operation.", value => filesOptions.Destination.ApiKey = value); filesystemOptionSet.Add("f|filesystem:", OptionCategory.SmugglerFileSystem, "The filesystem to operate on. If no specified, the operations will be on the default filesystem.", value => filesOptions.Source.DefaultFileSystem = value); filesystemOptionSet.Add("f2|filesystem2:", OptionCategory.SmugglerFileSystem, "The filesystem to export to. If no specified, the operations will be on the default filesystem. This parameter is used only in the between operation.", value => filesOptions.Destination.DefaultFileSystem = value); }
public void TestInOperatorString() { const string value = "goosfraba"; var source = new[] { new TestSource {String = "oos", Int = 1}, new TestSource {String = "fra", Int = 2}, new TestSource {String = "ba", Int = 3}, new TestSource {String = "fii", Int = 4}, new TestSource {String = "goos", Int = 5}, new TestSource {String = "osfra", Int = 6}, new TestSource {String = "faa", Int = 7} }; var expectedResultList = source.Where(t => value.Contains(t.String)).ToList(); var filter = new FilterSetting { OperatorName = FilterOperators.InOperator, PropertyPath = "String", Value = value }; var result = _builder.Filter(source.AsQueryable(), new[] { filter }); TestUtil.AssertModels(expectedResultList, result.ToList()); }
/// <summary> /// Applies passed filter to the query /// </summary> /// <typeparam name="T">Type of filtering objects</typeparam> /// <param name="query">Query apply filter to</param> /// <param name="filter">Poco contains filter values for filtering</param> /// <param name="filterSetting">Filter settings for filtering by passed property</param> private static IQueryable <T> ApplyFilter <T>(IQueryable <T> query, Filter filter, FilterSetting filterSetting) { // parameter for lambda expression var lambdaParameter = Expression.Parameter(typeof(T), "p"); // building path to the property (x => x.Property.AnotherProperty) var propertyAccess = GetPropertyAccess(lambdaParameter, filterSetting.PropertyPath); // get constant expression for first value var constantExpression = GetConstantExpression(filterSetting.ParameterType, filter.Values[0]); // get first condition for lambda expression var condition = GetMethodExpression(filterSetting.MethodName, propertyAccess, constantExpression); // if we have more than one value for property // then make condition for all if (!filterSetting.IsSingleFilter) { for (var i = 1; i < filter.Values.Length; i++) { var nextConstantExpression = GetConstantExpression(filterSetting.ParameterType, filter.Values[i]); condition = GetNextMethodExpression(condition, filterSetting, propertyAccess, nextConstantExpression); } } var lambda = Expression.Lambda <Func <T, bool> >(condition, lambdaParameter); return(query.Where(lambda)); }
public void TestIdioticWayToSpecifyOrFilters() { var source = new[] { new TestSource {String = "foo", Int = 1}, new TestSource {String = "bar", Int = 2}, new TestSource {String = "baz", Int = 3}, new TestSource {String = "fii", Int = 4}, new TestSource {String = "baz", Int = 5}, new TestSource {String = "fuu", Int = 6}, new TestSource {String = "zap", Int = 7} }; var expectedResultList = source.Where(t => t.String == "foo" || t.String == "bar" || t.String == "zap").ToList(); var fooFilter = new FilterSetting { OperatorName = FilterOperators.EqualsOperator, PropertyPath = "String", Value = "foo" }; var barFilter = new FilterSetting { OperatorName = FilterOperators.EqualsOperator, PropertyPath = "String", Value = "bar" }; var zapFilter = new FilterSetting { OperatorName = FilterOperators.EqualsOperator, PropertyPath = "String", Value = "zap" }; var zapOrContiner = new FilterSetting {OrConnectedFilters = new List<FilterSetting> {zapFilter}}; var barOrContainer = new FilterSetting { OrConnectedFilters = new List<FilterSetting> { new FilterSetting {OrConnectedFilters = new List<FilterSetting> {barFilter}} } }; var fooOrContainer = new FilterSetting { OrConnectedFilters = new List<FilterSetting> { new FilterSetting { OrConnectedFilters = new List<FilterSetting> { new FilterSetting { OrConnectedFilters = new List<FilterSetting> {fooFilter} } } } } }; var orFilter = new FilterSetting { OrConnectedFilters = new List<FilterSetting> { fooOrContainer, barOrContainer, zapOrContiner } }; var result = _builder.Filter(source.AsQueryable(), new[] { orFilter }); TestUtil.AssertModels(expectedResultList, result.ToList()); }
/// <summary> /// Applies sorting to already sorted query /// </summary> /// <typeparam name="T">Type of sorted object</typeparam> /// <param name="query">Query to apply sorting to</param> /// <param name="filterSetting">Filter settings for sorting by passed property</param> /// <returns></returns> private static IOrderedQueryable <T> ApplyNextSorting <T>(IOrderedQueryable <T> query, Sorting sorting, FilterSetting filterSetting) { // parameter for lambda expression var lambdaParameter = Expression.Parameter(typeof(T), "p"); // building path to the property (x => x.Property.AnotherProperty) var propertyAccess = GetPropertyAccess(lambdaParameter, filterSetting.PropertyPath); if (sorting.Direction == SortingDirection.Asc) { return(CallSortingMethod(query, "ThenBy", filterSetting.ParameterType, propertyAccess, lambdaParameter)); } if (sorting.Direction == SortingDirection.Desc) { return(CallSortingMethod(query, "ThenByDescending", filterSetting.ParameterType, propertyAccess, lambdaParameter)); } return(query); }
public void TestPropertyPathFiltering() { const string foo = "foo"; var source = new[] { new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "foo", Int = 1}}}, new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "bar", Int = 2}}}, new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "baz", Int = 3}}}, new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "foo", Int = 4}}}, new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "foo", Int = 5}}}, new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "zap", Int = 6}}}, new TestSource{ Inner = new InnerType{Complex = new TestSource {String = "foo", Int = 7}}} }; var expectedResultList = source.Where(t => t.Inner.Complex.String == foo).ToList(); var filter = new FilterSetting { OperatorName = FilterOperators.EqualsOperator, PropertyPath = "Inner.Complex.String", Value = foo }; var result = _builder.Filter(source.AsQueryable(), new[] { filter }); TestUtil.AssertModels(expectedResultList, result.ToList()); }
private Program() { optionSet = new OptionSet { { "operate-on-types:", "Specify the types to operate on. Specify the types to operate on. You can specify more than one type by combining items with a comma." + Environment.NewLine + "Default is all items." + Environment.NewLine + "Usage example: Indexes,Documents,Attachments", value => { try { if (string.IsNullOrWhiteSpace(value) == false) { options.OperateOnTypes = (ItemType)Enum.Parse(typeof(ItemType), value, ignoreCase: true); } } catch (Exception e) { PrintUsageAndExit(e); } } }, { "metadata-filter:{=}", "Filter documents by a metadata property." + Environment.NewLine + "Usage example: Raven-Entity-Name=Posts, or Raven-Entity-Name=Posts,Persons for multiple document types", (key, val) => options.Filters.Add(new FilterSetting { Path = "@metadata." + key, ShouldMatch = true, Values = FilterSetting.ParseValues(val) }) }, { "negative-metadata-filter:{=}", "Filter documents NOT matching a metadata property." + Environment.NewLine + "Usage example: Raven-Entity-Name=Posts", (key, val) => options.Filters.Add(new FilterSetting { Path = "@metadata." + key, ShouldMatch = false, Values = FilterSetting.ParseValues(val) }) }, { "filter:{=}", "Filter documents by a document property" + Environment.NewLine + "Usage example: Property-Name=Value", (key, val) => options.Filters.Add(new FilterSetting { Path = key, ShouldMatch = true, Values = FilterSetting.ParseValues(val) }) }, { "negative-filter:{=}", "Filter documents NOT matching a document property" + Environment.NewLine + "Usage example: Property-Name=Value", (key, val) => options.Filters.Add(new FilterSetting { Path = key, ShouldMatch = false, Values = FilterSetting.ParseValues(val) }) }, { "transform:", "Transform documents using a given script (import only)", script => options.TransformScript = script }, { "transform-file:", "Transform documents using a given script file (import only)", script => options.TransformScript = File.ReadAllText(script) }, { "max-steps-for-transform-script:", "Maximum number of steps that transform script can have (import only)", s => options.MaxStepsForTransformScript = int.Parse(s) }, { "timeout:", "The timeout to use for requests", s => options.Timeout = TimeSpan.FromMilliseconds(int.Parse(s)) }, { "batch-size:", "The batch size for requests", s => options.BatchSize = int.Parse(s) }, { "chunk-size:", "The number of documents to import before new connection will be opened", s => options.ChunkSize = int.Parse(s) }, { "d|database:", "The database to operate on. If no specified, the operations will be on the default database.", value => connectionStringOptions.DefaultDatabase = value }, { "d2|database2:", "The database to export to. If no specified, the operations will be on the default database. This parameter is used only in the between operation.", value => connectionStringOptions2.DefaultDatabase = value }, { "u|user|username:"******"The username to use when the database requires the client to authenticate.", value => ((NetworkCredential)connectionStringOptions.Credentials).UserName = value }, { "u2|user2|username2:", "The username to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => ((NetworkCredential)connectionStringOptions2.Credentials).UserName = value }, { "p|pass|password:"******"The password to use when the database requires the client to authenticate.", value => ((NetworkCredential)connectionStringOptions.Credentials).Password = value }, { "p2|pass2|password2:", "The password to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => ((NetworkCredential)connectionStringOptions2.Credentials).Password = value }, { "domain:", "The domain to use when the database requires the client to authenticate.", value => ((NetworkCredential)connectionStringOptions.Credentials).Domain = value }, { "domain2:", "The domain to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => ((NetworkCredential)connectionStringOptions2.Credentials).Domain = value }, { "key|api-key|apikey:", "The API-key to use, when using OAuth.", value => connectionStringOptions.ApiKey = value }, { "key2|api-key2|apikey2:", "The API-key to use, when using OAuth. This parameter is used only in the between operation.", value => connectionStringOptions2.ApiKey = value }, { "incremental", "States usage of incremental operations", _ => options.Incremental = true }, { "wait-for-indexing", "Wait until all indexing activity has been completed (import only)", _ => waitForIndexing = true }, { "excludeexpired", "Excludes expired documents created by the expiration bundle", _ => options.ShouldExcludeExpired = true }, { "limit:", "Reads at most VALUE documents/attachments.", s => options.Limit = int.Parse(s) }, { "h|?|help", v => PrintUsageAndExit(0) }, }; }
private void DefineDatabaseOptionsSet(SmugglerDatabaseOptions databaseOptions) { databaseOptionSet = new OptionSet(); databaseOptionSet.OnWarning += s => ConsoleHelper.WriteLineWithColor(ConsoleColor.Yellow, s); databaseOptionSet.Add("operate-on-types:", OptionCategory.SmugglerDatabase, "Specify the types to operate on. Specify the types to operate on. You can specify more than one type by combining items with a comma." + Environment.NewLine + "Default is all items." + Environment.NewLine + "Usage example: Indexes,Documents,Attachments,RemoveAnalyzers", value => { try { if (string.IsNullOrWhiteSpace(value) == false) { databaseOptions.OperateOnTypes = (ItemType)Enum.Parse(typeof(ItemType), value, ignoreCase: true); } } catch (Exception e) { PrintUsageAndExit(e); } }); databaseOptionSet.Add("metadata-filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents by a metadata property." + Environment.NewLine + "Usage example: Raven-Entity-Name=Posts, or Raven-Entity-Name=Posts,Persons for multiple document types", (key, val) => databaseOptions.Filters.Add(new FilterSetting { Path = "@metadata." + key, ShouldMatch = true, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("negative-metadata-filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents NOT matching a metadata property." + Environment.NewLine + "Usage example: Raven-Entity-Name=Posts", (key, val) => databaseOptions.Filters.Add( new FilterSetting { Path = "@metadata." + key, ShouldMatch = false, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents by a document property" + Environment.NewLine + "Usage example: Property-Name=Value", (key, val) => databaseOptions.Filters.Add( new FilterSetting { Path = key, ShouldMatch = true, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("negative-filter:{=}", OptionCategory.SmugglerDatabase, "Filter documents NOT matching a document property" + Environment.NewLine + "Usage example: Property-Name=Value", (key, val) => databaseOptions.Filters.Add( new FilterSetting { Path = key, ShouldMatch = false, Values = FilterSetting.ParseValues(val) })); databaseOptionSet.Add("ignore-errors-and-continue", OptionCategory.SmugglerDatabase, "If this option is enabled, smuggler will not halt its operation on errors. Errors still will be displayed to the user.", value => { databaseOptions.IgnoreErrorsAndContinue = true; }); databaseOptionSet.Add("transform:", OptionCategory.SmugglerDatabase, "Transform documents using a given script (import only)", script => databaseOptions.TransformScript = script); databaseOptionSet.Add("transform-file:", OptionCategory.SmugglerDatabase, "Transform documents using a given script file (import only)", script => databaseOptions.TransformScript = File.ReadAllText(script)); databaseOptionSet.Add("max-steps-for-transform-script:", OptionCategory.SmugglerDatabase, "Maximum number of steps that transform script can have (import only)", s => databaseOptions.MaxStepsForTransformScript = int.Parse(s)); databaseOptionSet.Add("batch-size:", OptionCategory.SmugglerDatabase, "The batch size for requests", s => databaseOptions.BatchSize = int.Parse(s)); databaseOptionSet.Add("chunk-size:", OptionCategory.SmugglerDatabase, "The number of documents to import before new connection will be opened", s => databaseOptions.ChunkSize = int.Parse(s)); databaseOptionSet.Add("d|database:", OptionCategory.SmugglerDatabase, "The database to operate on. If no specified, the operations will be on the default database.", value => databaseOptions.Source.DefaultDatabase = value); databaseOptionSet.Add("d2|database2:", OptionCategory.SmugglerDatabase, "The database to export to. If no specified, the operations will be on the default database. This parameter is used only in the between operation.", value => databaseOptions.Destination.DefaultDatabase = value); databaseOptionSet.Add("wait-for-indexing", OptionCategory.SmugglerDatabase, "Wait until all indexing activity has been completed (import only)", _ => databaseOptions.WaitForIndexing = true); databaseOptionSet.Add("excludeexpired", OptionCategory.SmugglerDatabase, "Excludes expired documents created by the expiration bundle", _ => databaseOptions.ShouldExcludeExpired = true); databaseOptionSet.Add("disable-versioning-during-import", OptionCategory.SmugglerDatabase, "Disables versioning for the duration of the import", _ => databaseOptions.ShouldDisableVersioningBundle = true); databaseOptionSet.Add("limit:", OptionCategory.SmugglerDatabase, "Reads at most VALUE documents/attachments.", s => databaseOptions.Limit = int.Parse(s)); databaseOptionSet.Add("max-split-export-file-size:", OptionCategory.SmugglerDatabase, "Split exported file by size (after compression) in MB", s => databaseOptions.MaxSplitExportFileSize = int.Parse(s)); databaseOptionSet.Add("timeout:", OptionCategory.SmugglerDatabase, "The timeout to use for requests", s => databaseOptions.Timeout = TimeSpan.FromMilliseconds(int.Parse(s))); databaseOptionSet.Add("incremental", OptionCategory.SmugglerDatabase, "States usage of incremental operations", _ => databaseOptions.Incremental = true); databaseOptionSet.Add("u|user|username:"******"The username to use when the database requires the client to authenticate.", value => GetCredentials(databaseOptions.Source).UserName = value); databaseOptionSet.Add("u2|user2|username2:", OptionCategory.SmugglerDatabase, "The username to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(databaseOptions.Destination).UserName = value); databaseOptionSet.Add("p|pass|password:"******"The password to use when the database requires the client to authenticate.", value => GetCredentials(databaseOptions.Source).Password = value); databaseOptionSet.Add("p2|pass2|password2:", OptionCategory.SmugglerDatabase, "The password to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(databaseOptions.Destination).Password = value); databaseOptionSet.Add("domain:", OptionCategory.SmugglerDatabase, "The domain to use when the database requires the client to authenticate.", value => GetCredentials(databaseOptions.Source).Domain = value); databaseOptionSet.Add("domain2:", OptionCategory.SmugglerDatabase, "The domain to use when the database requires the client to authenticate. This parameter is used only in the between operation.", value => GetCredentials(databaseOptions.Destination).Domain = value); databaseOptionSet.Add("key|api-key|apikey:", OptionCategory.SmugglerDatabase, "The API-key to use, when using OAuth.", value => databaseOptions.Source.ApiKey = value); databaseOptionSet.Add("key2|api-key2|apikey2:", OptionCategory.SmugglerDatabase, "The API-key to use, when using OAuth. This parameter is used only in the between operation.", value => databaseOptions.Destination.ApiKey = value); databaseOptionSet.Add("strip-replication-information", OptionCategory.SmugglerDatabase, "Remove all replication information from metadata (import only)", _ => databaseOptions.StripReplicationInformation = true); databaseOptionSet.Add("continuation-token:", OptionCategory.SmugglerDatabase, "Activates the usage of a continuation token in case of unreliable connections or huge imports", s => databaseOptions.ContinuationToken = s); databaseOptionSet.Add("skip-conflicted", OptionCategory.SmugglerDatabase, "The database will issue and error when conflicted documents are put. The default is to alert the user, this allows to skip them to continue.", _ => databaseOptions.SkipConflicted = true); databaseOptionSet.Add("system-database", OptionCategory.SmugglerDatabase, "Set to true in order to work on a system database", _ => allowOperationOnSystemDatabase = true); }
public IList <NameValuePair> ClearFilter() { FilterSetting = null; return(Repository.List()); }