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


C# IConnectionInfo.GetConnectionProperties方法代码示例

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


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

示例1: GetSchemaAndBuildAssembly

        public override List<ExplorerItem> GetSchemaAndBuildAssembly(IConnectionInfo connectionInfo, AssemblyName assemblyToBuild, ref string nameSpace, ref string typeName)
        {
            var properties = connectionInfo.GetConnectionProperties();

            // using code from Microsoft's OData v4 Client Code Generator. see https://visualstudiogallery.msdn.microsoft.com/9b786c0e-79d1-4a50-89a5-125e57475937
            var client = new ODataClient(new Configuration(properties.Uri, nameSpace, properties));
            var code = client.GenerateCode();

            // Compile the code into the assembly, using the assembly name provided:
            BuildAssembly(code, assemblyToBuild);

            var model = properties.GetModel();

            typeName = GetContainerName(model);
            var schema = model.GetSchema();

            return schema;
        }
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:18,代码来源:OData4DynamicDriver.cs

示例2: GetNamespacesToAdd

        public override IEnumerable<string> GetNamespacesToAdd(IConnectionInfo connectionInfo)
        {
            if (_namespaces == null || _namespaces.Count == 0)
            {
                var model = connectionInfo.GetConnectionProperties().GetModel();
                var namespaces = model.DeclaredNamespaces.Select(o => BaseNamespacePrefix + "." + o).ToList();
                _namespaces = namespaces.Count > 1 ? namespaces.ToList() : new List<string>(1);
                _namespaces.Add("Microsoft.OData.Client");
            }

            return _namespaces;
        }
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:12,代码来源:OData4DynamicDriver.cs

示例3: GetContextConstructorArguments

 public override object[] GetContextConstructorArguments(IConnectionInfo connectionInfo)
 {
     // We need to pass the chosen URI into the DataServiceContext's constructor:
     return new object[] { new Uri(connectionInfo.GetConnectionProperties().Uri) };
 }
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:5,代码来源:OData4DynamicDriver.cs

示例4: GetConnectionDescription

 public override string GetConnectionDescription(IConnectionInfo connectionInfo)
 {
     return connectionInfo.GetConnectionProperties().Uri;
 }
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:4,代码来源:OData4DynamicDriver.cs

示例5: ShowConnectionDialog

        public override bool ShowConnectionDialog(IConnectionInfo connectionInfo, bool isNewConnection)
        {
            var connectionProperties = connectionInfo.GetConnectionProperties();

            // Populate the default URI with a demo data:
            if (isNewConnection)
                connectionProperties.Uri = "http://services.odata.org/V4/OData/OData.svc/";

            return new ConnectionDialog(connectionProperties).ShowDialog() == true;
        }
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:10,代码来源:OData4DynamicDriver.cs

示例6: InitializeContext

        public override void InitializeContext(IConnectionInfo connectionInfo, object context, QueryExecutionManager executionManager)
        {
            var dsContext = (DataServiceContext)context;

            var properties = connectionInfo.GetConnectionProperties();
            dsContext.Credentials = properties.GetCredentials();

            dsContext.Configurations.RequestPipeline.OnMessageCreating += args =>
            {
                var message = new CustomizedRequestMessage(args, properties);
                return message;
            };

            dsContext.SendingRequest2 += (s, e) =>
            {
                executionManager.SqlTranslationWriter.WriteLine($"URL:\t\t{e.RequestMessage.Url}");

                if (properties.LogMethod)
                    executionManager.SqlTranslationWriter.WriteLine($"Method:\t{e.RequestMessage.Method}");

                if (properties.LogHeaders)
                {
                    executionManager.SqlTranslationWriter.WriteLine("Headers:");
                    var headers = string.Join("\r\n", e.RequestMessage.Headers.Select(o => $"\t{o.Key}:{o.Value}"));
                    executionManager.SqlTranslationWriter.WriteLine(headers);
                }
            };
        }
开发者ID:meancrazy,项目名称:LINQPadOData4,代码行数:28,代码来源:OData4DynamicDriver.cs


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