コード例 #1
1
        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
0
 public ConnectionManager(IPreferences preferences, IPowerManager powerManager, IConnectionInfo connectionInfo, IBlackoutTime blackoutTime)
 {
     Preferences = preferences;
     PowerManager = powerManager;
     ConnectionInfo = connectionInfo;
     BlackoutTime = blackoutTime;
 }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
 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";
 }
コード例 #5
0
      public override ParameterDescriptor[] GetContextConstructorParameters(IConnectionInfo cxInfo)
      {
         var providerNameParameter = new ParameterDescriptor("providerName", "System.String");
         var connectionStringParameter = new ParameterDescriptor("connectionString", "System.String");

         return new[] { providerNameParameter, connectionStringParameter };
      }
コード例 #6
0
        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);
        }
コード例 #7
0
        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;
        }
コード例 #8
0
		/// <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);
		}
コード例 #9
0
 public PostgreSqlTablesProvider(IConnectionInfo cxInfo, ModuleBuilder moduleBuilder, IDbConnection connection, string nameSpace)
 {
    this.cxInfo = cxInfo;
    this.moduleBuilder = moduleBuilder;
    this.connection = connection;
    this.nameSpace = nameSpace;
 }
コード例 #10
0
		public override object[] GetContextConstructorArguments(IConnectionInfo cxInfo)
		{
			var connInfo = CassandraConnectionInfo.Load(cxInfo);
			CacheDefinitionIfNessisary(connInfo);

			return new[] { connInfo.CreateContext() };
		}
コード例 #11
0
		public override ParameterDescriptor[] GetContextConstructorParameters(IConnectionInfo cxInfo)
		{
			var connInfo = CassandraConnectionInfo.Load(cxInfo);
			CacheDefinitionIfNessisary(connInfo);

			return new[] { new ParameterDescriptor("context", "FluentCassandra.CassandraContext") };
		}
コード例 #12
0
    /// <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
0
    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;
    }
コード例 #14
0
 public ConnectionDialog(IConnectionInfo connectionInfo)
 {
     this.connectionInfo = connectionInfo;
     this.driverData = new LuceneDriverData();
     DataContext = this.driverData;
     InitializeComponent();
 }
コード例 #15
0
 public override bool ShowConnectionDialog(IConnectionInfo repository, bool isNewRepository)
 {
     using (CxForm form = new CxForm((Repository) repository, isNewRepository))
     {
         return (form.ShowDialog() == DialogResult.OK);
     }
 }
コード例 #16
0
 public override IEnumerable<string> GetNamespacesToAdd(IConnectionInfo cxInfo)
 {
     var set = new HashSet<string>(base.GetNamespacesToAdd(cxInfo));
     var settings = GetCxSettings(cxInfo);
     set.UnionWith(settings.NamespacesToAdd);
     return set.ToList();
 }
コード例 #17
0
        /// <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);
        }
コード例 #18
0
 public override object[] GetContextConstructorArguments(IConnectionInfo cxInfo)
 {
     _connInfo = RavenConnectionDialogViewModel.Load(cxInfo);
     // ReSharper disable CoVariantArrayConversion
     return new[] { _connInfo };
     // ReSharper restore CoVariantArrayConversion
 }
コード例 #19
0
		public ConnectionDialog(IConnectionInfo cxInfo)
		{
			_cxInfo = cxInfo;
            _cxInfo.DisplayName = "SECS device";
            DataContext = cxInfo;
			InitializeComponent();
		}
コード例 #20
0
      public override IDbConnection GetIDbConnection(IConnectionInfo cxInfo)
      {
         var connectionString = cxInfo.GetPostgreSqlConnectionString();

         var connection = new NpgsqlConnection(connectionString);
         return connection;
      }
コード例 #21
0
 public override object[] GetContextConstructorArguments(IConnectionInfo cxInfo)
 {
     var mongoProps = new MongoLinqpadProperties(cxInfo);
     var mongoSessionType = typeof(MongoSession);
     var ctor = mongoSessionType.GetConstructor(new[] { typeof(string) });
     var session = ctor.Invoke(new object[] { mongoProps.ConnectionString });
     return new[] {session};
 }
コード例 #22
0
 public override bool AreRepositoriesEquivalent(IConnectionInfo c1, IConnectionInfo c2)
 {
     if (!base.AreRepositoriesEquivalent(c1, c2))
     {
         return false;
     }
     return c1.CustomTypeInfo.IsEquivalent(c2.CustomTypeInfo);
 }
コード例 #23
0
 public virtual bool AreRepositoriesEquivalent(IConnectionInfo c1, IConnectionInfo c2)
 {
     if (!c1.DatabaseInfo.IsEquivalent(c2.DatabaseInfo))
     {
         return false;
     }
     return (this.IsBuiltIn || (c1.DriverData.ToString() == c2.DriverData.ToString()));
 }
コード例 #24
0
 public override IEnumerable<string> GetNamespacesToAdd(IConnectionInfo cxInfo)
 {
     if (GacResolver.IsEntityFrameworkAvailable)
     {
         return new string[] { "System.Data.EntityClient", "System.Data.Metadata.Edm", "System.Data.Objects", "System.Data.Objects.DataClasses" };
     }
     return null;
 }
コード例 #25
0
 public override IEnumerable<string> GetAssembliesToAdd(IConnectionInfo cxInfo)
 {
     var set = new HashSet<string>(base.GetAssembliesToAdd(cxInfo));
     var settings = GetCxSettings(cxInfo);
     var paths = CxSettingsPathsHelper.Current.GetAssemblyLocations(settings);
     set.UnionWith(paths);
     return set.ToList();
 }
コード例 #26
0
 public override List<ExplorerItem> GetSchemaAndBuildAssembly(IConnectionInfo cxInfo, AssemblyName assemblyToBuild, ref string nameSpace, ref string typeName)
 {
     return SchemaBuilder.GetSchemaAndBuildAssembly(
         new CsvDataContextDriverProperties(cxInfo),
         assemblyToBuild,
         ref nameSpace,
         ref typeName);
 }
コード例 #27
0
 ISessionFactory GetSessionFactory(IConnectionInfo cxInfo)
 {
     var assembly = GetClientAssembly(cxInfo);
     var method = assembly.GetExportedTypes().SelectMany(x => x.GetMethods())
         .First(x => x.IsStatic &&
                     x.ReturnType == typeof(ISessionFactory));
     return (ISessionFactory)method.Invoke(null, null);
 }
コード例 #28
0
        public MongoLinqpadPropsForm(IConnectionInfo cxInfo, bool isNewConnection)
        {
            this.cxInfo = cxInfo;
            this.isNewConnection = isNewConnection;
            Connection = new MongoLinqpadProperties(cxInfo);

            InitializeComponent();
        }
コード例 #29
0
 internal Type GetCustomType(IConnectionInfo c)
 {
     if ((c.CustomTypeInfo.CustomAssemblyPath.Length == 0) || (c.CustomTypeInfo.CustomTypeName.Length == 0))
     {
         return null;
     }
     return Assembly.LoadFrom(c.CustomTypeInfo.CustomAssemblyPath).GetType(c.CustomTypeInfo.CustomTypeName);
 }
コード例 #30
0
        public ConnectionDialog(IConnectionInfo cxInfo)
        {
            _cxInfo = cxInfo;
            DataContext = cxInfo.CustomTypeInfo;
            Background = SystemColors.ControlBrush;

            InitializeComponent();
        }
 /// <summary>
 /// Called when the Driver context is torn down to clean up resources
 /// </summary>
 public override void TearDownContext(IConnectionInfo cxInfo, object context, QueryExecutionManager executionManager, object[] constructorArguments)
 {
     ((MongoServer)constructorArguments[0]).Disconnect();
 }
 /// <summary>
 /// Gets an array describing the types of objects that will be passed into the dynamically
 /// instantiated driver
 /// </summary>
 /// <param name="cxInfo">the serialized connection properties.</param>
 public override ParameterDescriptor[] GetContextConstructorParameters(IConnectionInfo cxInfo)
 {
     return(new[] { new ParameterDescriptor("mongo", typeof(MongoServer).FullName), });
 }
 public override string GetConnectionDescription(IConnectionInfo cxInfo)
 {
     return(cxInfo.DisplayName);
 }
        /// <summary>
        /// Gets the additional namespaces that should be imported for queries using this driver
        /// </summary>
        /// <param name="cxInfo">the serialized connection properties.</param>
        /// <returns>The namespaces that should be imported as strings</returns>
        public override IEnumerable <string> GetNamespacesToAdd(IConnectionInfo cxInfo)
        {
            ConnectionProperties props = propsSerializer.Deserialize(cxInfo.DriverData);

            return(GetNamespacesToAdd(props));
        }
コード例 #35
0
 public override void ExecuteESqlQuery(IConnectionInfo cxInfo, string query)
 {
     throw new Exception("ESQL queries are not supported for this type of connection");
 }
コード例 #36
0
 public override string GetConnectionDescription(IConnectionInfo connectionInfo)
 {
     return(connectionInfo.GetConnectionProperties().Uri);
 }
コード例 #37
0
 public override bool ShowConnectionDialog(IConnectionInfo cxInfo, bool isNewConnection)
 {
     // Prompt the user for a custom assembly and type name:
     return(new ConnectionDialog(cxInfo).ShowDialog() == true);
 }
コード例 #38
0
 public override IDbConnection GetIDbConnection(IConnectionInfo connectionInfo)
 {
     return(null);
 }
コード例 #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StorageAccountProperties"/> class.
 /// </summary>
 /// <param name="connectionInfo">The connection info.</param>
 public StorageAccountProperties(IConnectionInfo connectionInfo)
 {
     this._connectionInfo = connectionInfo;
     this._driverData     = connectionInfo.DriverData;
 }
コード例 #40
0
        public override List <ExplorerItem> GetSchemaAndBuildAssembly(IConnectionInfo cxInfo, AssemblyName assemblyToBuild, ref string nameSpace, ref string typeName)
        {
            nameSpace = "Umbraco.Generated";
            typeName  = "GeneratedUmbracoDataContext";

            var umbFolder = new DirectoryInfo(cxInfo.AppConfigPath);

            //load all assemblies in the umbraco bin folder
            var loadedAssemblies = Directory.GetFiles(Path.Combine(umbFolder.FullName, "bin"), "*.dll").Select(LoadAssemblySafely).ToList();

            //we'll need to manually resolve any assemblies loaded above
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
            {
                //This is stupid but is required becaue the TypeFinder is looking for an App_Code assembly, so we'll generate an empty one
                if (args.Name == "App_Code")
                {
                    return(ResolveAppCode());
                }

                var found = loadedAssemblies.FirstOrDefault(x => x.GetName().Name == new AssemblyName(args.Name).Name);

                return(found);
            };

            //Create a loader to startup the umbraco app to create the schema and the generated DataContext class

            var driverFolder = GetDriverFolder();

            var gatewayLoader = new GatewayLoader(
                LoadAssemblySafely(Path.Combine(driverFolder, "UmbracoLinqPad.Gateway.dll")),
                loadedAssemblies.Single(x => x.GetName().Name == "Umbraco.Core"),
                LoadAssemblySafely(Path.Combine(driverFolder, "IQToolkit.dll")));

            using (var app = gatewayLoader.StartUmbracoApplication(new DirectoryInfo(cxInfo.AppConfigPath)))
            {
                using (var appCtx = app.ApplicationContext)
                {
                    var contentItemsCompiler = (IContentItemsCompiler)Activator.CreateInstance(
                        gatewayLoader.GatewayAssembly.GetType("UmbracoLinqPad.Gateway.Compilers.ContentItemsCompiler"));
                    var dataContextCompiler = (IDataContextCompiler)Activator.CreateInstance(
                        gatewayLoader.GatewayAssembly.GetType("UmbracoLinqPad.Gateway.Compilers.DataContextCompiler"));

                    var sb = new StringBuilder();

                    //create the content type classes
                    foreach (var compiled in contentItemsCompiler.GenerateClasses(appCtx.RealUmbracoApplicationContext))
                    {
                        sb.Append(compiled);
                    }

                    //add the data context class
                    sb.Append(dataContextCompiler.GenerateClass(typeName, appCtx.RealUmbracoApplicationContext));

                    var result = BuildAssembly(gatewayLoader, sb.ToString(), assemblyToBuild, nameSpace);

                    var dataContextType = result.CompiledAssembly.GetType(string.Format("{0}.{1}", nameSpace, typeName));

                    var properties = dataContextType.GetProperties()
                                                                          //Get all properties of enumerable IGeneratedContentBase
                                     .Where(x => typeof(IEnumerable <Models.IGeneratedContentBase>).IsAssignableFrom(x.PropertyType))
                                     .GroupBy(x => x.Name.Split('_')[0]); //group on 'category' property name

                    return(properties.Select(category =>
                                             new ExplorerItem(category.Key, ExplorerItemKind.Category, ExplorerIcon.Table)
                    {
                        Children = category
                                   .Select(x => new ExplorerItem(x.Name, ExplorerItemKind.QueryableObject, ExplorerIcon.View)
                        {
                            IsEnumerable = true
                        }).ToList()
                    }).ToList());
                }
            }
        }
コード例 #41
0
 public override string GetConnectionDescription(IConnectionInfo cxInfo)
 {
     return("Umbraco :: " + cxInfo.AppConfigPath);
 }
コード例 #42
0
ファイル: Linq2AzureDriver.cs プロジェクト: AntoineGa/API
 public override ParameterDescriptor[] GetContextConstructorParameters(IConnectionInfo cxInfo)
 {
     return new[] { new ParameterDescriptor("publishSettingsPath", "System.String") };
 }
コード例 #43
0
 /// <summary>
 /// Makes a single attempt to connect to the database.
 /// </summary>
 /// <param name="connectionInfo">Database connection settings.</param>
 /// <seealso cref="Reconnect" />
 private void Connect(IConnectionInfo connectionInfo)
 {
     _cluster = Cluster.Builder().AddContactPoint(connectionInfo.HostName).Build();
     _session = _cluster.Connect(connectionInfo.KeyspaceName);
     _mapper  = new Mapper(_session);
 }
コード例 #44
0
 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) });
 }
コード例 #45
0
 public override IEnumerable <string> GetAssembliesToAdd(IConnectionInfo connectionInfo)
 {
     // We need the following assembly for compiliation and autocompletion:
     return(Assemblies);
 }
コード例 #46
0
 public BaseRepository(IConnectionInfo connectionInfo)
 {
     _connectionString = connectionInfo.ConnectionString;
 }
コード例 #47
0
 public DB2Properties(IConnectionInfo cxInfo)
 {
     _cxInfo     = cxInfo;
     _driverData = cxInfo.DriverData;
 }
コード例 #48
0
 public LogFileRepository(IConnectionInfo connectionInfo)
     : base(connectionInfo)
 {
 }
コード例 #49
0
 public ConnectionModel(IConnectionInfo connectionInfo,
                        IEnumerable <string> knownUris = null)
 {
     this.connectionInfo = connectionInfo;
     this.knownUris      = knownUris ?? new string[0];
 }
コード例 #50
0
 public override ParameterDescriptor[] GetContextConstructorParameters(IConnectionInfo connectionInfo)
 {
     // We need to pass the chosen URI into the DataServiceContext's constructor:
     return(new[] { new ParameterDescriptor("serviceRoot", "System.Uri") });
 }
コード例 #51
0
ファイル: FDEProcess.cs プロジェクト: wwcc19870805/DIFGIS
 public FDEProcess()
 {
     this.dsf  = new DataSourceFactoryClass();
     this.info = new ConnectionInfoClass();
 }
コード例 #52
0
 public override void TearDownContext(IConnectionInfo cxInfo, object context, QueryExecutionManager executionManager, object[] constructorArguments)
 {
     ((IDisposable)context).Dispose();
 }
コード例 #53
0
 public override void OnQueryFinishing(IConnectionInfo cxInfo, object context, QueryExecutionManager executionManager)
 {
     //There’s also an OnQueryFinishing method that you can override. Unlike TearDownContext, this runs just before the query ends, so you can Dump extra output  in this method. You can also block for as long as you like—while waiting on some background threads to finish, for instance. If the user gets tired of waiting, they’ll hit the Cancel button in which case your thread will be aborted, and the TearDownContext method will then run. (The next thing to happen is that your application domain will be torn down and recreated, unless the user’s requested otherwise in Edit | Preferences | Advanced, or has cached objects alive).
 }
コード例 #54
0
 public override bool AreRepositoriesEquivalent(IConnectionInfo r1, IConnectionInfo r2)
 {
     return(Equals(r1.DriverData.Element("Uri"), r2.DriverData.Element("Uri")));
 }
コード例 #55
0
 public override ParameterDescriptor[] GetContextConstructorParameters(IConnectionInfo r)
 {
     return(new ParameterDescriptor[] { new ParameterDescriptor("connection", "System.Data.IDbConnection") });
 }
コード例 #56
0
 internal override string GetImageKey(IConnectionInfo r)
 {
     return("L2S");
 }
コード例 #57
0
 public override string GetConnectionDescription(IConnectionInfo r)
 {
     return(null);
 }
コード例 #58
0
 public override object[] GetContextConstructorArguments(IConnectionInfo r)
 {
     return(new object[] { DataContextBase.GetConnection(r.DatabaseInfo.GetCxString(), r.DatabaseInfo.Provider) });
 }
コード例 #59
0
ファイル: Linq2AzureDriver.cs プロジェクト: AntoineGa/API
 public override string GetConnectionDescription(IConnectionInfo cxInfo)
 {
     return new Linq2AzureProperties(cxInfo).PublishSettingsPath;
 }
コード例 #60
0
ファイル: Linq2AzureDriver.cs プロジェクト: AntoineGa/API
 public override IEnumerable<string> GetAssembliesToAdd(IConnectionInfo cxInfo)
 {
     // We need the following assembly for compiliation and autocompletion:
     return new[] { "System.Runtime.dll", "Linq2Azure.dll", "System.Reactive.Core.dll", "System.Reactive.Interfaces.dll", "System.Reactive.Linq.dll" };
 }