本文整理汇总了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;
}
示例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;
}
示例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) };
}
示例4: GetConnectionDescription
public override string GetConnectionDescription(IConnectionInfo connectionInfo)
{
return connectionInfo.GetConnectionProperties().Uri;
}
示例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;
}
示例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);
}
};
}