コード例 #1
0
ファイル: QueryDataSourceCommand.cs プロジェクト: koav/Rhetos
 public QueryDataSourceCommand(
     IDataTypeProvider dataTypeProvider,
     IIndex<string, IQueryDataSourceCommandImplementation> repositories)
 {
     _dataTypeProvider = dataTypeProvider;
     _repositories = repositories;
 }
コード例 #2
0
 public ApplicationDatabase(
     IConnectionStringProvider connectionStringProvider,
     IIndex<string, IDatabaseProvider> providerLookup)
 {
     this.connectionStringProvider = connectionStringProvider;
     this.providerLookup = providerLookup;
 }
コード例 #3
0
        public IndexReader(IIndex index, bool openReadOnly)
        {
            if (index == null)
                throw new ArgumentNullException("index", "index cannot be null");
            this.index = index;
            this.isReadOnly = openReadOnly;
            this.isDisposed = false;
            switch (index.IndexStructure) {
                case IndexType.SingleIndex:
                    var singleIndex = (IIndex)index;
                    if (!singleIndex.HasIndexFiles())
                        throw new InvalidOperationException("There are no index files in the specified directory " + index.IndexDirectory.FullName);
                    this.luceneDirectory = singleIndex.GetLuceneDirectory();
                    break;
                case IndexType.DoubleIndex:
                case IndexType.CyclicalIndex:
                    var doubleIndex = (DoubleIndex)index;
                    if (!doubleIndex.HasIndexFiles())
                        throw new InvalidOperationException("There are no index files in the specified directory " + index.IndexDirectory.FullName);
                    this.luceneDirectory = doubleIndex.GetLuceneDirectory();
                    break;
                default:
                    throw new NotSupportedException(index.IndexStructure.ToString() + " not supported");
            }

            this.luceneReader = Lucene29.Net.Index.IndexReader.Open(this.luceneDirectory, openReadOnly);
        }
コード例 #4
0
        private static string GetMessage(
            IIndex primaryIndex,
            IIndex foreignIndex,
            object primaryKey)
        {
            string foreignTable =
                foreignIndex.Table.EntityType.Name;

            string foreignColumns =
                string.Join(", ", foreignIndex.KeyInfo.EntityKeyMembers.Select(m => m.Name));

            string primaryTable =
                primaryIndex.Table.EntityType.Name;

            string primaryColumns =
                string.Join(", ", primaryIndex.KeyInfo.EntityKeyMembers.Select(m => m.Name));

            return string.Format(
                ExceptionMessages.ForeignKeyViolation,
                foreignTable,
                foreignColumns,
                primaryKey,
                primaryTable,
                primaryColumns);
        }
コード例 #5
0
ファイル: Core.cs プロジェクト: MartinF/Dynamo.Jiss
		public Core(IIndex index)
		{
			if (index == null)
				throw new ArgumentNullException("index");

			_index = index;		
		}
コード例 #6
0
 public CreateIndexCommand(
     IIndex index,
     IEnumerable<int> addedDocumentIds,
     string tablePrefix) : base(index, tablePrefix)
 {
     _addedDocumentIds = addedDocumentIds;
 }
コード例 #7
0
ファイル: DbAccessProvider.cs プロジェクト: RH-Code/YAFNET
        /// <summary>
        ///     Initializes a new instance of the <see cref="DbAccessProvider" /> class.
        /// </summary>
        /// <param name="dbAccessProviders">
        ///     The db access providers.
        /// </param>
        /// <param name="serviceLocator">
        ///     The service locator.
        /// </param>
        public DbAccessProvider(IIndex<string, IDbAccess> dbAccessProviders, IServiceLocator serviceLocator)
        {
            this._dbAccessProviders = dbAccessProviders;
            this._serviceLocator = serviceLocator;
            this._providerName = Config.ConnectionProviderName;

            this._dbAccessSafe = new SafeReadWriteProvider<IDbAccess>(
                () =>
                    {
                        IDbAccess dbAccess;

                        // attempt to get the provider...
                        if (this._dbAccessProviders.TryGetValue(this.ProviderName, out dbAccess))
                        {
                            // first time...
                            this._serviceLocator.Get<IRaiseEvent>().Raise(new InitDatabaseProviderEvent(this.ProviderName, dbAccess));
                        }
                        else
                        {
                            throw new NoValidDbAccessProviderFoundException(
                                @"Unable to Locate Provider Named ""{0}"" in Data Access Providers (DLL Not Located in Bin Directory?).".FormatWith(
                                    this.ProviderName));
                        }

                        return dbAccess;
                    });
        }
 public void Import(IIndex index, int count)
 {
     var reader = new DataDumpReader<Post>();
     var xml = Path.Combine(path, "posts.xml");
     index.Add(reader.Read(xml)
         .Where(p => p.PostTypeId == PostTypeId.Question)
         .Take(count));
 }
コード例 #9
0
 public ForeignKeyViolationException(
     IIndex primaryIndex,
     IIndex foreignIndex,
     object primaryKey)
     : base(ErrorCode.RelationError, 
         GetMessage(primaryIndex, foreignIndex, primaryKey))
 {
 }
コード例 #10
0
 public void Setup()
 {
     var mappingSet = ModelSetup.SetupModel();
     database = mappingSet.Database;
     table = database.Tables[0];
     index = new Index("index1");
     table.AddIndex(index);
 }
コード例 #11
0
ファイル: MapState.cs プロジェクト: SmartFire/yessql
        public MapState(IIndex map, MapStates state)
        {
            Map = map;
            State = state;

            RemovedDocuments = new List<Document>();
            AddedDocuments = new List<Document>();
        }
コード例 #12
0
ファイル: AggregateTable.cs プロジェクト: ikvm/deveelsql
        public void InitGroups(QueryProcessor processor, IIndex<long> emptyIndexContainer)
        {
            Debug.Assert(emptyIndexContainer.Count == 0);

            ITable child = BaseTable;
            // No groups, so make the entire child table the group,
            if (aggregateComposite == null || child.RowCount <= 1) {
                emptyIndexContainer.Add(0);
                emptyIndexContainer.Add(child.RowCount);
            }
                // Populate the index by the aggregate composite,
            else {
                // Create a resolver for the composite function
                IndexResolver resolver = processor.CreateResolver(child, aggregateComposite);

                // The groups state
                long groupPos = 0;
                long groupSize = 0;
                SqlObject[] lastComposite = null;
                // Scan over the child
                IRowCursor cursor = child.GetRowCursor();
                while (cursor.MoveNext()) {
                    RowId rowid = cursor.Current;
                    // Get the group term
                    SqlObject[] groupValue = resolver.GetValue(rowid);
                    if (lastComposite == null) {
                        lastComposite = groupValue;
                    } else {
                        int c = SqlObject.Compare(groupValue, lastComposite);
                        // If group_val > the last composite, we are on a new group
                        if (c > 0) {
                            // New group,
                            emptyIndexContainer.Add(groupPos);
                            emptyIndexContainer.Add(groupSize);
                            lastComposite = groupValue;
                            groupPos = groupPos + groupSize;
                            groupSize = 0;
                        } else if (c < 0) {
                            // This will happen if the child table is not sorted by the
                            // composite expression.
                            throw new ApplicationException("Aggregate child is not sorted correctly.");
                        }
                    }
                    ++groupSize;
                }
                // Final group
                // (the below check probably not necessary since we already check for the
                //  empty child so group size will always be >1 at this point).
                if (groupSize > 0) {
                    emptyIndexContainer.Add(groupPos);
                    emptyIndexContainer.Add(groupSize);
                }
            }
            // Set the group index
            childGroupsIndex = emptyIndexContainer;
            lookupCursor = BaseTable.GetRowCursor();
        }
 public override IEnumerable<IAnnotation> For(IIndex index)
 {
     if (index.MyCat().Method != null)
     {
         yield return new Annotation(
              MyCatAnnotationNames.Prefix + MyCatAnnotationNames.IndexMethod,
              index.MyCat().Method);
     }
 }
コード例 #14
0
 public static void Output_index(IIndex index)
 {
     foreach (var e in index.Entries)
     {
         System.Console.WriteLine("{0}", e.Word);
         foreach (var dn in e.DocumentNames)
             System.Console.WriteLine("\t{0}", dn);
     }
 }
コード例 #15
0
        public override void DetachFromModel()
        {
            if (Detached || Index == null) return;

            Index.PropertyChanged -= Index_PropertyChanged;
            Index = null;
            Detached = true;
            SetupForm();
        }
コード例 #16
0
        public void AttachToModel(IIndex index)
        {
            if (!Detached) DetachFromModel();

            Index = index;
            index.PropertyChanged += Index_PropertyChanged;
            Detached = false;
            SetupForm();
        }
コード例 #17
0
 public UpdatableResultSetView(SystemTransaction transaction, IMutableTable backedTable, Expression[] project, IRowCursor select)
 {
     this.transaction = transaction;
     this.backedTable = backedTable;
     this.project = project;
     originalSelect = select;
     currentSelect = select;
     this.select = null;
 }
コード例 #18
0
 private void Dump_index(IIndex index)
 {
     foreach(var e in index.Entries)
     {
         System.Console.WriteLine("{0}", e.Word);
         foreach(var dn in e.DocumentNames)
             System.Console.WriteLine("\t{0}", dn);
     }
 }
 public override IEnumerable<IAnnotation> For(IIndex index)
 {
     if (index.SqlServer().IsClustered.HasValue)
     {
         yield return new Annotation(
              SqlServerAnnotationNames.Prefix + SqlServerAnnotationNames.Clustered,
              index.SqlServer().IsClustered.Value);
     }
 }
コード例 #20
0
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public override IEnumerable<IAnnotation> For(IIndex index)
 {
     var isClustered = index.SqlServer().IsClustered;
     if (isClustered.HasValue)
     {
         yield return new Annotation(
             SqlServerFullAnnotationNames.Instance.Clustered,
             isClustered.Value);
     }
 }
コード例 #21
0
ファイル: Core.cs プロジェクト: MartinF/Dynamo.AutoTT
		public Core(IIndex index, IFeedbackManager feedback)
		{
			if (index == null)
				throw new ArgumentNullException("index");
			if (feedback == null)
				throw new ArgumentNullException("feedback");

			_index = index;
			Feedback = feedback;
		}
コード例 #22
0
 public override void TestFixtureSetUp()
 {
     base.TestFixtureSetUp();
     connection.RunAsync(Query.DbCreate("test")).Wait();
     connection.RunAsync(Query.Db("test").TableCreate("table")).Wait();
     testTable = Query.Db("test").Table<TestObject>("table");
     nameIndex = testTable.IndexDefine("index1", o => o.Name);
     connection.Run(nameIndex.IndexCreate());
     connection.Run(nameIndex.IndexWait());
 }
コード例 #23
0
 public override void TestFixtureSetUp()
 {
     base.TestFixtureSetUp();
     connection.RunAsync(Query.DbCreate("test")).Wait();
     connection.RunAsync(Query.Db("test").TableCreate("table")).Wait();
     testTable = Query.Db("test").Table<TestObject>("table");
     nameIndex = testTable.IndexDefine("index1", o => o.Name);
     connection.Run(nameIndex.IndexCreate());
     connection.Run(nameIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed
 }
コード例 #24
0
 public DatabaseUpgradeDetector(
     IConnectionStringProvider connectionStringProvider, 
     IEnumerable<ScriptedExtension> extensions, 
     IApplicationDatabase database,
     IIndex<string, IDatabaseProvider> currentProviderLookup)
 {
     this.connectionStringProvider = connectionStringProvider;
     this.extensions = extensions;
     this.database = database;
     this.currentProviderLookup = currentProviderLookup;
 }
コード例 #25
0
 public void SetUp()
 {
     connectionString = Substitute.For<IConnectionStringProvider>();
     connectionString.Schema = "dbo";
     connectionString.DatabaseProvider = "sql";
     applicationDatabase = Substitute.For<IApplicationDatabase>();
     databaseProviderLookup = Substitute.For<IIndex<string, IDatabaseProvider>>();
     databaseProvider = Substitute.For<IDatabaseProvider>();
     databaseProviderLookup[Arg.Any<string>()].Returns(databaseProvider);
     detector = new DatabaseUpgradeDetector(connectionString, extensions, applicationDatabase, databaseProviderLookup);
 }
コード例 #26
0
ファイル: SaveEntityCommand.cs プロジェクト: kmeze/Rhetos
 public SaveEntityCommand(
     IIndex<string, IWritableRepository> writableRepositories,
     GenericRepositories genericRepositories,
     IPersistenceTransaction persistenceTransaction,
     ServerCommandsUtility serverCommandsUtility)
 {
     _writableRepositories = writableRepositories;
     _genericRepositories = genericRepositories;
     _persistenceTransaction = persistenceTransaction;
     _serverCommandsUtility = serverCommandsUtility;
 }
コード例 #27
0
ファイル: Server.cs プロジェクト: dahmaneaissi/Papercut
        public Server(
            ServerProtocolType serverProtocolType,
            IIndex<ServerProtocolType, Func<IProtocol>> protocolFactory,
            ConnectionManager connectionManager,
            ILogger logger)
        {
            ConnectionManager = connectionManager;

            _serverProtocolType = serverProtocolType;
            Logger = logger.ForContext("ServerProtocolType", _serverProtocolType);
            ProtocolFactory = protocolFactory[_serverProtocolType];
        }
コード例 #28
0
ファイル: PluginManager.cs プロジェクト: jameshy/else
 public PluginManager(
     IIndex<string, Func<PluginLoader>> pluginLoaderFactory,
     Lazy<AppCommands> appCommands,
     Paths paths,
     Settings settings,
     ILogger logger)
 {
     _pluginLoaderFactory = pluginLoaderFactory;
     _appCommands = appCommands;
     _paths = paths;
     _settings = settings;
     _logger = logger;
 }
コード例 #29
0
 public AppController()
 {
     // initializing properties
     this.SearchRequest = String.Empty;
     this.ExactMatch = false;
     this.Files = new ObservableCollection<FileDescription>();
     this.Results = new ObservableCollection<ResultFound>();
     this.IndexItems = new ObservableCollection<WordIndexDisplay>();
     // preparing lemmatizer and index
     index = new Index(EnglishLemmatizer.Get());
     index.FilesChanged += index_FilesChanged;
     updateListOfFiles();
 }
コード例 #30
0
        public override void Init(int flowCount, long flowRecordCount)
        {
            database.CodeGeneration = true;
            database.Open(Path.Combine(DataDirectory, "volante.dbs"), CACHE_SIZE_IN_BYTES);

            database.ObjectCacheInitSize = 4 * 1024;
            database.ExtensionQuantum = 16 * 1024 * 1024;
            database.ObjectCacheInitSize = 4 * 1319;

            table = database.CreateIndex<long, TickEntity>(IndexType.Unique);

            database.Commit();
        }