public QueryDataSourceCommand( IDataTypeProvider dataTypeProvider, IIndex<string, IQueryDataSourceCommandImplementation> repositories) { _dataTypeProvider = dataTypeProvider; _repositories = repositories; }
public ApplicationDatabase( IConnectionStringProvider connectionStringProvider, IIndex<string, IDatabaseProvider> providerLookup) { this.connectionStringProvider = connectionStringProvider; this.providerLookup = providerLookup; }
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); }
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); }
public Core(IIndex index) { if (index == null) throw new ArgumentNullException("index"); _index = index; }
public CreateIndexCommand( IIndex index, IEnumerable<int> addedDocumentIds, string tablePrefix) : base(index, tablePrefix) { _addedDocumentIds = addedDocumentIds; }
/// <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)); }
public ForeignKeyViolationException( IIndex primaryIndex, IIndex foreignIndex, object primaryKey) : base(ErrorCode.RelationError, GetMessage(primaryIndex, foreignIndex, primaryKey)) { }
public void Setup() { var mappingSet = ModelSetup.SetupModel(); database = mappingSet.Database; table = database.Tables[0]; index = new Index("index1"); table.AddIndex(index); }
public MapState(IIndex map, MapStates state) { Map = map; State = state; RemovedDocuments = new List<Document>(); AddedDocuments = new List<Document>(); }
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); } }
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); } }
public override void DetachFromModel() { if (Detached || Index == null) return; Index.PropertyChanged -= Index_PropertyChanged; Index = null; Detached = true; SetupForm(); }
public void AttachToModel(IIndex index) { if (!Detached) DetachFromModel(); Index = index; index.PropertyChanged += Index_PropertyChanged; Detached = false; SetupForm(); }
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; }
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); } }
/// <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); } }
public Core(IIndex index, IFeedbackManager feedback) { if (index == null) throw new ArgumentNullException("index"); if (feedback == null) throw new ArgumentNullException("feedback"); _index = index; Feedback = feedback; }
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()); }
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 }
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; }
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); }
public SaveEntityCommand( IIndex<string, IWritableRepository> writableRepositories, GenericRepositories genericRepositories, IPersistenceTransaction persistenceTransaction, ServerCommandsUtility serverCommandsUtility) { _writableRepositories = writableRepositories; _genericRepositories = genericRepositories; _persistenceTransaction = persistenceTransaction; _serverCommandsUtility = serverCommandsUtility; }
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]; }
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; }
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(); }
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(); }