本文整理汇总了C#中IConnectionInfo类的典型用法代码示例。如果您正苦于以下问题:C# IConnectionInfo类的具体用法?C# IConnectionInfo怎么用?C# IConnectionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IConnectionInfo类属于命名空间,在下文中一共展示了IConnectionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSchema
public override List<ExplorerItem> GetSchema(IConnectionInfo connectionInfo, Type customType)
{
var indexDirectory = connectionInfo.DriverData.FromXElement<LuceneDriverData>().IndexDirectory;
//TODO: Fields with configured delimiters should show up as a tree
//TODO: Show Numeric and String fields with their types
//TODO: If the directory selected contains sub-directories, maybe we should show them all...
using (var directory = FSDirectory.Open(new DirectoryInfo(indexDirectory)))
using (var indexReader = IndexReader.Open(directory, true))
{
return indexReader
.GetFieldNames(IndexReader.FieldOption.ALL)
.Select(fieldName =>
{
//var field = //TODO: Get the first document with this field and get its types.
return new ExplorerItem(fieldName, ExplorerItemKind.QueryableObject, ExplorerIcon.Column)
{
IsEnumerable = false, //TODO: Should be true when its a multi-field
ToolTipText = "Cool tip"
};
})
.ToList();
}
}
示例2: ConnectionManager
public ConnectionManager(IPreferences preferences, IPowerManager powerManager, IConnectionInfo connectionInfo, IBlackoutTime blackoutTime)
{
Preferences = preferences;
PowerManager = powerManager;
ConnectionInfo = connectionInfo;
BlackoutTime = blackoutTime;
}
示例3: PostgreSqlTablesProvider
public PostgreSqlTablesProvider(IConnectionInfo cxInfo, ModuleBuilder moduleBuilder, IDbConnection connection, string nameSpace)
{
this.cxInfo = cxInfo;
this.moduleBuilder = moduleBuilder;
this.connection = connection;
this.nameSpace = nameSpace;
}
示例4: MainWindow
/// <summary>
/// Constructor
/// </summary>
/// <param name="cxInfo">IConnectionInfo</param>
/// <param name="isNewConnection">Indicate if this is new connection request or update existing connection</param>
public MainWindow(IConnectionInfo cxInfo, bool isNewConnection)
{
InitializeComponent();
// Instantiate ViewModel and pass parameters.
vm = new MainWindowViewModel(cxInfo, isNewConnection);
myGrid.DataContext = vm;
}
示例5: GetNamespacesToAdd
public override IEnumerable<string> GetNamespacesToAdd(IConnectionInfo cxInfo)
{
yield return "System.Net"; // for IPAddress type
yield return "System.Net.NetworkInformation"; // for PhysicalAddress type
yield return "LinqToDB";
yield return "NpgsqlTypes";
}
示例6: FailoverRoundRobin
public FailoverRoundRobin(IConnectionInfo connectionDetails)
{
if (!(connectionDetails.BrokerCount > 0))
{
throw new ArgumentException("At least one broker details must be specified.");
}
_connectionDetails = connectionDetails;
//There is no current broker at startup so set it to -1.
_currentBrokerIndex = -1;
String cycleRetries = _connectionDetails.GetFailoverOption(ConnectionUrlConstants.OPTIONS_FAILOVER_CYCLE);
if (cycleRetries != null)
{
try
{
_cycleRetries = int.Parse(cycleRetries);
}
catch (FormatException)
{
_cycleRetries = DEFAULT_CYCLE_RETRIES;
}
}
_currentCycleRetries = 0;
_serverRetries = 0;
_currentServerRetry = -1;
}
示例7: ShowConnectionDialog
public override bool ShowConnectionDialog(IConnectionInfo repository, bool isNewRepository)
{
using (CxForm form = new CxForm((Repository) repository, isNewRepository))
{
return (form.ShowDialog() == DialogResult.OK);
}
}
示例8: GetConnectionDescription
public override string GetConnectionDescription(IConnectionInfo cxInfo) {
// Save the cxInfo to use elsewhere. Note this method is called a lot, but it seems to be the first time we'll see the cxInfo.
_cxInfo = cxInfo;
// We show the namespace qualified typename.
return cxInfo.CustomTypeInfo.CustomTypeName;
}
示例9: GetContextConstructorArguments
public override object[] GetContextConstructorArguments(IConnectionInfo cxInfo)
{
var connInfo = CassandraConnectionInfo.Load(cxInfo);
CacheDefinitionIfNessisary(connInfo);
return new[] { connInfo.CreateContext() };
}
示例10: GetContextConstructorParameters
public override ParameterDescriptor[] GetContextConstructorParameters(IConnectionInfo cxInfo)
{
var connInfo = CassandraConnectionInfo.Load(cxInfo);
CacheDefinitionIfNessisary(connInfo);
return new[] { new ParameterDescriptor("context", "FluentCassandra.CassandraContext") };
}
示例11: GetConnectionDescription
/// <summary>Returns the text to display in the root Schema Explorer node for a given connection info.</summary>
public override string GetConnectionDescription(IConnectionInfo cxInfo)
{
var connInfo = CassandraConnectionInfo.Load(cxInfo);
CacheDefinitionIfNessisary(connInfo);
return String.Format("{0}/{1} - {2}", connInfo.Host, connInfo.Port, connInfo.Keyspace);
}
示例12: GetContextConstructorArguments
/// <summary>
/// We're using the parameterless EM constructor, so no constructor arguments are provided.
/// </summary>
public override object[] GetContextConstructorArguments(IConnectionInfo cxInfo) {
// We need to fix MEF probing in some circumstances, so let's check and do it before creating the EM.
DevForceTypes.CheckComposition(cxInfo);
return null;
}
示例13: InitializeContext
public override void InitializeContext(IConnectionInfo cxInfo, object context, QueryExecutionManager executionManager)
{
// This method gets called after a DataServiceContext has been instantiated. It gives us a chance to
// perform further initialization work.
//
// And as it happens, we have an interesting problem to solve! The typed data service context class
// that Astoria's EntityClassGenerator generates handles the ResolveType delegate as follows:
//
// return this.GetType().Assembly.GetType (string.Concat ("<namespace>", typeName.Substring (19)), true);
//
// Because LINQPad subclasses the typed data context when generating a query, GetType().Assembly returns
// the assembly of the user query rather than the typed data context! To work around this, we must take
// over the ResolveType delegate and resolve using the context's base type instead:
var dsContext = (DataServiceContext)context;
var typedDataServiceContextType = context.GetType ().BaseType;
dsContext.ResolveType = name => typedDataServiceContextType.Assembly.GetType
(typedDataServiceContextType.Namespace + "." + name.Split ('.').Last ());
// The next step is to feed any supplied credentials into the Astoria service.
// (This could be enhanced to support other authentication modes, too).
var props = new AstoriaProperties (cxInfo);
dsContext.Credentials = props.GetCredentials ();
// Finally, we handle the SendingRequest event so that it writes the request text to the SQL translation window:
dsContext.SendingRequest += (sender, e) => executionManager.SqlTranslationWriter.WriteLine (e.Request.RequestUri);
}
示例14: ConnectionDialog
public ConnectionDialog(IConnectionInfo connectionInfo)
{
this.connectionInfo = connectionInfo;
this.driverData = new LuceneDriverData();
DataContext = this.driverData;
InitializeComponent();
}
示例15: AreRepositoriesEquivalent
/// <summary>
/// Determines whether two repositories are equivalent.
/// </summary>
/// <param name="connection1">The connection information of the first repository.</param>
/// <param name="connection2">The connection information of the second repository.</param>
/// <returns><c>true</c> if both repositories use the same account name; <c>false</c> otherwise.</returns>
public override bool AreRepositoriesEquivalent(IConnectionInfo connection1, IConnectionInfo connection2)
{
var account1 = (string)connection1.DriverData.Element("AccountName") ?? string.Empty;
var account2 = (string)connection2.DriverData.Element("AccountName") ?? string.Empty;
return account1.Equals(account2);
}