当前位置: 首页>>代码示例>>C#>>正文


C# SmugglerOptions.ItemTypeParser方法代码示例

本文整理汇总了C#中Raven.Abstractions.Smuggler.SmugglerOptions.ItemTypeParser方法的典型用法代码示例。如果您正苦于以下问题:C# SmugglerOptions.ItemTypeParser方法的具体用法?C# SmugglerOptions.ItemTypeParser怎么用?C# SmugglerOptions.ItemTypeParser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Raven.Abstractions.Smuggler.SmugglerOptions的用法示例。


在下文中一共展示了SmugglerOptions.ItemTypeParser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Program

		private Program()
		{
			connectionStringOptions = new RavenConnectionStringOptions();
			options = new SmugglerOptions();

			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
			            			                                                                     		{
			            			                                                                     			options.OperateOnTypes =
                                                                                                                    (ItemType)
                                                                                                                    options.ItemTypeParser(
                                                                                                                        value);
			            			                                                                     		}
			            			                                                                     		catch (Exception e)
			            			                                                                     		{
			            			                                                                     			PrintUsageAndExit(e);
			            			                                                                     		}
			            			                                                                     	}
			            			},
			            		{
			            			"metadata-filter:{=}", "Filter documents by a metadata property." + Environment.NewLine +
			            			                       "Usage example: Raven-Entity-Name=Posts", (key, val) => options.Filters["@metadata." + key] = val
			            			},
			            		{
			            			"filter:{=}", "Filter documents by a document property" + Environment.NewLine +
			            			              "Usage example: Property-Name=Value", (key, val) => options.Filters[key] = val
			            			},
			            		{"d|database:", "The database to operate on. If no specified, the operations will be on the default database.", value => connectionStringOptions.DefaultDatabase = value},
			            		{"u|user|username:", "The username to use when the database requires the client to authenticate.", value => Credentials.UserName = value},
			            		{"p|pass|password:", "The password to use when the database requires the client to authenticate.", value => Credentials.Password = value},
			            		{"domain:", "The domain to use when the database requires the client to authenticate.", value => Credentials.Domain = value},
			            		{"key|api-key|apikey:", "The API-key to use, when using OAuth.", value => connectionStringOptions.ApiKey = value},
								{"incremental", "States usage of incremental operations", _ => incremental = true },
			            		{"h|?|help", v => PrintUsageAndExit(0)},
			            	};
		}
开发者ID:dominionenterprises,项目名称:ravendb,代码行数:42,代码来源:Program.cs

示例2: Program

		private Program()
		{
			connectionStringOptions = new RavenConnectionStringOptions();
			options = new SmugglerOptions();

			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
			            			                                                                     		{
			            			                                                                     			options.OperateOnTypes = options.ItemTypeParser(value);
			            			                                                                     		}
			            			                                                                     		catch (Exception e)
			            			                                                                     		{
			            			                                                                     			PrintUsageAndExit(e);
			            			                                                                     		}
			            			                                                                     	}
			            			},
			            		{
			            			"metadata-filter:{=}", "Filter documents by a metadata property." + Environment.NewLine +
			            			                       "Usage example: Raven-Entity-Name=Posts", (key, val) => options.Filters.Add(new FilterSetting
			            			                       {
				            			                       Path = "@metadata." + key,
															   ShouldMatch = true,
															   Values = new List<string>{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 = new List<string>{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 = new List<string>{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 = new List<string>{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)
			            		},
								{"timeout:", "The timeout to use for requests", s => options.Timeout = int.Parse(s) },
								{"batch-size:", "The batch size for requests", s => options.BatchSize = 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},
			            		{"u|user|username:", "The username to use when the database requires the client to authenticate.", value => Credentials.UserName = value},
			            		{"p|pass|password:", "The password to use when the database requires the client to authenticate.", value => Credentials.Password = value},
			            		{"domain:", "The domain to use when the database requires the client to authenticate.", value => Credentials.Domain = value},
			            		{"key|api-key|apikey:", "The API-key to use, when using OAuth.", value => connectionStringOptions.ApiKey = value},
								{"incremental", "States usage of incremental operations", _ => 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 },
			            		{"h|?|help", v => PrintUsageAndExit(0)},
			            	};
		}
开发者ID:robashton,项目名称:ravendb,代码行数:77,代码来源:Program.cs


注:本文中的Raven.Abstractions.Smuggler.SmugglerOptions.ItemTypeParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。