• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ClientModel.ServiceClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AutoRest.Core.ClientModel.ServiceClient的典型用法代码示例。如果您正苦于以下问题:C# ServiceClient类的具体用法?C# ServiceClient怎么用?C# ServiceClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ServiceClient类属于AutoRest.Core.ClientModel命名空间,在下文中一共展示了ServiceClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RequirementsTemplateModel

 /// <summary>
 /// Initializes a new instance of RequirementsTemplateModel class.
 /// </summary>
 /// <param name="serviceClient">The service client.</param>
 /// <param name="sdkName">The name of the SDK.</param>
 /// <param name="implementationFileExtension">The files extension.</param>
 /// <param name="ns">The namespace of the SDK.</param>
 public RequirementsTemplateModel(ServiceClient serviceClient, string sdkName, string implementationFileExtension, string ns)
 {
     this.LoadFrom(serviceClient);
     this.ns = ns;
     this.sdkName = sdkName;
     this.implementationFileExtension = implementationFileExtension;
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:14,代码来源:RequirementsTemplateModel.cs


示例2: AzureFluentModelTemplateModel

 public AzureFluentModelTemplateModel(CompositeType source, ServiceClient serviceClient)
     : base(source, serviceClient)
 {
     _namer = new AzureJavaFluentCodeNamer(serviceClient.Namespace);
     PropertyModels = new List<PropertyModel>();
     Properties.ForEach(p => PropertyModels.Add(new FluentPropertyModel(p, serviceClient.Namespace, IsInnerModel)));
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:7,代码来源:AzureFluentModelTemplateModel.cs


示例3: AzureServiceClientTemplateModel

 /// <summary>
 /// Initializes a new instance of the AzureServiceClientTemplateModel class.
 /// </summary>
 /// <param name="serviceClient">The service client instance.</param>
 public AzureServiceClientTemplateModel(ServiceClient serviceClient)
     : base(serviceClient)
 {
     MethodTemplateModels.Clear();
     Methods.Where(m => m.Group == null)
         .ForEach(m => MethodTemplateModels.Add(new AzureMethodTemplateModel(m, serviceClient)));
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:11,代码来源:AzureServiceClientTemplateModel.cs


示例4: TestGenerate

        private static async Task TestGenerate(string apiVersion, string[] methodUrls, string expectedJsonString)
        {
            MemoryFileSystem fileSystem = new MemoryFileSystem();

            Settings settings = new Settings();
            settings.FileSystem = fileSystem;

            ServiceClient serviceClient = new ServiceClient();
            serviceClient.ApiVersion = apiVersion;
            foreach(string methodUrl in methodUrls)
            {
                serviceClient.Methods.Add(new Method()
                {
                    Url = methodUrl,
                    HttpMethod = HttpMethod.Put,
                });
            }
            await CreateGenerator(settings).Generate(serviceClient);

            Assert.Equal(2, fileSystem.VirtualStore.Count);

            string folderPath = fileSystem.VirtualStore.Keys.First();
            Assert.Equal("Folder", fileSystem.VirtualStore[folderPath].ToString());

            JObject expectedJSON = JObject.Parse(expectedJsonString);

            string fileContents = fileSystem.VirtualStore[fileSystem.VirtualStore.Keys.Skip(1).First()].ToString();
            JObject actualJson = JObject.Parse(fileContents);

            Assert.Equal(expectedJSON, actualJson);
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:31,代码来源:AzureResourceSchemaCodeGeneratorTests.cs


示例5: NormalizeClientModelDoesNothing

        public void NormalizeClientModelDoesNothing()
        {
            ServiceClient serviceClient = new ServiceClient();
            CreateGenerator().NormalizeClientModel(serviceClient);

            // Nothing happens
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:7,代码来源:AzureResourceSchemaCodeGeneratorTests.cs


示例6: AzureMethodGroupTemplateModel

 public AzureMethodGroupTemplateModel(ServiceClient serviceClient, string methodGroupName)
     : base(serviceClient, methodGroupName)
 {
     MethodTemplateModels.Clear();
     Methods.Where(m => m.Group == MethodGroupName)
         .ForEach(m => MethodTemplateModels.Add(new AzureMethodTemplateModel(m, serviceClient)));
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:7,代码来源:AzureMethodGroupTemplateModel.cs


示例7: AzureMethodGroupTemplateModel

        public AzureMethodGroupTemplateModel(ServiceClient serviceClient, string methodGroupName)
            : base(serviceClient, methodGroupName)
        {
            // Clear base initialized MethodTemplateModels and re-populate with
            // AzureMethodTemplateModel
            MethodTemplateModels.Clear();

            var currentMethods = Methods.Where(m => m.Group == MethodGroupName && m.Extensions.ContainsKey(AzureExtensions.PageableExtension));
            var nextListMethods = new List<Method>();
            foreach (var method in currentMethods)
            {
                var pageableExtension = method.Extensions[AzureExtensions.PageableExtension] as Newtonsoft.Json.Linq.JContainer;
                var operationName = (string)pageableExtension["operationName"];
                if (operationName != null)
                {
                    var nextLinkMethod = Methods.FirstOrDefault(m =>
                        operationName.Equals(m.SerializedName, StringComparison.OrdinalIgnoreCase));
                    if (nextLinkMethod != null)
                    {
                        method.Extensions["nextLinkURL"] = nextLinkMethod.Url;
                        method.Extensions["nextLinkParameters"] = nextLinkMethod.LogicalParameters;
                        nextListMethods.Add(nextLinkMethod);
                    }
                }
            }
            Methods.RemoveAll(m => nextListMethods.Contains(m));
            Methods.Where(m => m.Group == methodGroupName)
                .ForEach(m => MethodTemplateModels.Add(new AzureMethodTemplateModel(m, serviceClient)));
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:29,代码来源:AzureMethodGroupTemplateModel.cs


示例8: NormalizeAzureClientModel

        /// <summary>
        /// Normalizes client model using Azure-specific extensions.
        /// </summary>
        /// <param name="serviceClient">Service client</param>
        /// <param name="settings">AutoRest settings</param>
        /// <param name="codeNamer">AutoRest settings</param>
        /// <returns></returns>
        public static void NormalizeAzureClientModel(ServiceClient serviceClient, Settings settings, CodeNamer codeNamer)
        {
            if (serviceClient == null)
            {
                throw new ArgumentNullException("serviceClient");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (codeNamer == null)
            {
                throw new ArgumentNullException("codeNamer");
            }

            settings.AddCredentials = true;

            // This extension from general extensions must be run prior to Azure specific extensions.
            ProcessParameterizedHost(serviceClient, settings);
            
            ProcessClientRequestIdExtension(serviceClient);
            UpdateHeadMethods(serviceClient);
            ParseODataExtension(serviceClient);
            ProcessGlobalParameters(serviceClient);
            FlattenModels(serviceClient);
            FlattenMethodParameters(serviceClient, settings);
            ParameterGroupExtensionHelper.AddParameterGroups(serviceClient);
            AddLongRunningOperations(serviceClient);
            AddAzureProperties(serviceClient);
            SetDefaultResponses(serviceClient);
            AddPageableMethod(serviceClient, codeNamer);
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:39,代码来源:AzureExtensions.cs


示例9: Generate

        /// <summary>
        /// Generates Go code for service client.
        /// </summary>
        /// <param name="serviceClient"></param>
        /// <returns></returns>
        public override async Task Generate(ServiceClient serviceClient)
        {
            string packageName = GoCodeNamer.PackageNameFromNamespace(Settings.Namespace);
            
            // Service client
            var serviceClientTemplate = new ServiceClientTemplate
            {
                Model = new ServiceClientTemplateModel(serviceClient, packageName),
            };
            await Write(serviceClientTemplate, GoCodeNamer.FormatFileName("client"));

            foreach (var methodGroupName in serviceClient.MethodGroups)
            {
                var groupedMethodTemplate = new MethodGroupTemplate
                {
                    Model = new MethodGroupTemplateModel(serviceClient, packageName, methodGroupName),
                };
                await Write(groupedMethodTemplate, GoCodeNamer.FormatFileName(methodGroupName.ToLowerInvariant()));
            }

            // Models
            var modelsTemplate = new ModelsTemplate
            {
                Model = new ModelsTemplateModel(serviceClient, packageName),
            };
            await Write(modelsTemplate, GoCodeNamer.FormatFileName("models"));

            // Version
            var versionTemplate = new VersionTemplate
            {
                Model = new VersionTemplateModel(serviceClient, packageName),
            };
            await Write(versionTemplate, GoCodeNamer.FormatFileName("version"));
        }
开发者ID:haocs,项目名称:autorest,代码行数:39,代码来源:GoCodeGenerator.cs


示例10: Generate

 public override async Task Generate(ServiceClient serviceClient)
 {
     var viewModel = new SampleViewModel();
     var model = new SampleModel();
     model.Model = viewModel;
     await Write(model, Path.Combine(Settings.ModelsName, "Pet.cs"));
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:7,代码来源:SampleCodeGenerator.cs


示例11: VersionTemplateModel

        public VersionTemplateModel(ServiceClient serviceClient, string packageName, string[] version)
        {
            this.LoadFrom(serviceClient);

            PackageName = packageName;
            Version = version;
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:7,代码来源:VersionTemplateModel.cs


示例12: ServiceClientTemplateModel

        public ServiceClientTemplateModel(ServiceClient serviceClient, string packageName, string methodGroupName = null)
        {
            this.LoadFrom(serviceClient);

            MethodGroupName = methodGroupName == null
                                ? string.Empty
                                : methodGroupName;
            PackageName = packageName == null
                            ? string.Empty
                            : packageName;

            BaseClient = "ManagementClient";
            ClientName = string.IsNullOrEmpty(MethodGroupName)
                            ? BaseClient
                            : MethodGroupName.IsNamePlural(PackageName)
                                             ? MethodGroupName + "Client"
                                             : (MethodGroupName + "Client").TrimPackageName(PackageName);
            MethodScope = new MethodScopeProvider();
            MethodTemplateModels = new List<MethodTemplateModel>();

            Methods.Where(m => m.BelongsToGroup(MethodGroupName, PackageName))
                    .OrderBy(m => m.Name)
                    .ForEach(m => MethodTemplateModels.Add(new MethodTemplateModel(m, ClientName, PackageName, new MethodScopeProvider())));

            Documentation = string.Format("Package {0} implements the Azure ARM {1} service API version {2}.\n\n{3}", PackageName, ServiceName, ApiVersion,
                                    !string.IsNullOrEmpty(Documentation) ? Documentation.UnwrapAnchorTags() : "");
            ClientDocumentation = string.Format("{0} is the base client for {1}.", ClientName, ServiceName);
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:28,代码来源:ServiceClientTemplateModel.cs


示例13: MethodTemplateModel

 public MethodTemplateModel(Method source, ServiceClient serviceClient)
 {
     this.LoadFrom(source);
     ParameterTemplateModels = new List<ParameterTemplateModel>();
     source.Parameters.ForEach(p => ParameterTemplateModels.Add(new ParameterTemplateModel(p)));
     ServiceClient = serviceClient;
     if (source.Group != null)
     {
         OperationName = source.Group.ToPascalCase();
     }
     else
     {
         OperationName = serviceClient.Name;
     }
     AddCustomHeader = true;
     string formatter;
     foreach (var parameter in LocalParameters)
     {
         if (string.IsNullOrWhiteSpace(parameter.DefaultValue))
         {
             parameter.DefaultValue = PythonConstants.None;
         }
     }
     foreach (Match m in Regex.Matches(Url, @"\{[\w]+:[\w]+\}"))
     {
         formatter = m.Value.Split(':').First() + '}';
         Url = Url.Replace(m.Value, formatter);
     }
 }
开发者ID:garimakhulbe,项目名称:autorest,代码行数:29,代码来源:MethodTemplateModel.cs


示例14: NameCollisionTestWithoutNamespace

        public void NameCollisionTestWithoutNamespace()
        {
            var serviceClient = new ServiceClient();
            serviceClient.Name = "azure always rocks!";

            var customObjectType = new CompositeType();
            customObjectType.Name = "azure always rocks!";

            var baseType = new CompositeType();
            baseType.Name = "azure always rocks!";

            serviceClient.Methods.Add(new Method
            {
                Name = "azure always rocks!",
                Group = "azure always rocks!",
                ReturnType = new Response(customObjectType, null)
            });

            serviceClient.ModelTypes.Add(customObjectType);
            serviceClient.ModelTypes.Add(baseType);

            var framework = new CSharpCodeNamer();
            framework.ResolveNameCollisions(serviceClient, null, null);

            Assert.Equal("azure always rocks!Client", serviceClient.Name);
            Assert.Equal("azure always rocks!Operations", serviceClient.MethodGroups.First());
            Assert.Equal("azure always rocks!", serviceClient.Methods[0].Name);
            Assert.Equal("azure always rocks!", serviceClient.ModelTypes.First(m => m.Name == "azure always rocks!").Name);
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:29,代码来源:CSharpCodeNamingFrameworkTests.cs


示例15: AzureServiceClientTemplateModel

 public AzureServiceClientTemplateModel(ServiceClient serviceClient, bool internalConstructors)
     : base(serviceClient, internalConstructors)
 {
     // TODO: Initialized in the base constructor. Why Clear it?
     MethodTemplateModels.Clear();
     Methods.Where(m => m.Group == null)
         .ForEach(m => MethodTemplateModels.Add(new AzureMethodTemplateModel(m, serviceClient, SyncMethodsGenerationMode.None)));
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:8,代码来源:AzureServiceClientTemplateModel.cs


示例16: NormalizeClientModel

 /// <summary>
 /// Normalizes client model by updating names and types to be language specific.
 /// </summary>
 /// <param name="serviceClientModel"></param>
 public override void NormalizeClientModel(ServiceClient serviceClientModel)
 {
     // Add the current package name as a reserved keyword
     _namingFramework.ReserveNamespace(Settings.Namespace);
     _namingFramework.NormalizeClientModel(serviceClientModel);
     _namingFramework.ResolveNameCollisions(serviceClientModel, Settings.Namespace,
         Settings.Namespace + ".Models");
 }
开发者ID:haocs,项目名称:autorest,代码行数:12,代码来源:GoCodeGenerator.cs


示例17: NormalizeClientModel

 /// <summary>
 /// Normalizes client model by updating names and types to be language specific.
 /// </summary>
 /// <param name="serviceClient"></param>
 public override void NormalizeClientModel(ServiceClient serviceClient)
 {
     PopulateAdditionalProperties(serviceClient);
     SwaggerExtensions.NormalizeClientModel(serviceClient, Settings);
     _namer.NormalizeClientModel(serviceClient);
     _namer.ResolveNameCollisions(serviceClient, Settings.Namespace,
         Settings.Namespace + "." + Settings.ModelsName);
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:12,代码来源:CSharpCodeGenerator.cs


示例18: ExtensionsTemplateModel

 public ExtensionsTemplateModel(ServiceClient serviceClient, string operationName, SyncMethodsGenerationMode syncWrappers)
 {
     this.LoadFrom(serviceClient);
     MethodTemplateModels = new List<MethodTemplateModel>();
     ExtensionName = operationName ?? this.Name;
     this.Methods.Where(m => m.Group == operationName)
         .ForEach(m => MethodTemplateModels.Add(new MethodTemplateModel(m, serviceClient, syncWrappers)));
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:8,代码来源:ExtensionsTemplateModel.cs


示例19: NormalizeClientModel

 /// <summary>
 /// Normalizes client model using generic extensions.
 /// </summary>
 /// <param name="serviceClient">Service client</param>
 /// <param name="settings">AutoRest settings</param>
 /// <returns></returns>
 public static void NormalizeClientModel(ServiceClient serviceClient, Settings settings)
 {
     ProcessGlobalParameters(serviceClient);
     FlattenModels(serviceClient);
     FlattenMethodParameters(serviceClient, settings);
     ParameterGroupExtensionHelper.AddParameterGroups(serviceClient);
     ProcessParameterizedHost(serviceClient, settings);
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:14,代码来源:SwaggerExtensions.cs


示例20: NormalizeClientModel

 /// <summary>
 /// Normalizes client model by updating names and types to be language specific.
 /// </summary>
 /// <param name="serviceClient"></param>
 public override void NormalizeClientModel(ServiceClient serviceClient)
 {
     SwaggerExtensions.NormalizeClientModel(serviceClient, Settings);
     PopulateAdditionalProperties(serviceClient);
     Namer.NormalizeClientModel(serviceClient);
     Namer.ResolveNameCollisions(serviceClient, Settings.Namespace,
         Settings.Namespace + ".Models");
     Namer.NormalizeOdataFilterParameter(serviceClient);
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:13,代码来源:NodeJSCodeGenerator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Utilities.IndentedStringBuilder类代码示例发布时间:2022-05-24
下一篇:
C# AutoMapper.TypeMap类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap