/// <summary> /// Does an object insert and creates the necessary indexes for /// a local uule entity. /// </summary> /// <param name="transaction"></param> /// <param name="localUULE"></param> private void Insert(Transaction transaction, LocalUULE localUULE) { bool newEntity = localUULE.ID == 0; if (newEntity) { localUULE.ID = transaction.ObjectGetNewIdentity <int>(_table); } transaction.ObjectInsert(_table, new DBreezeObject <LocalUULE> { NewEntity = newEntity, Entity = localUULE, Indexes = new List <DBreezeIndex> { new DBreezeIndex(1, localUULE.ID) { PrimaryIndex = true }, new DBreezeIndex(2, localUULE.CityID) { AddPrimaryToTheEnd = false } } }); }
public void Insert(LocalUULE localUULE) { using (Transaction transaction = _engine.GetTransaction()) { Insert(transaction, localUULE); transaction.Commit(); } }
public override PipelinedCrawlDescription Flow(PipelinedCrawlDescription pipelinedCrawlDescription) { LinkedListNode <CrawlDescription> node = pipelinedCrawlDescription.CrawlDescriptions.First; while (node != null) { SearchString searchString = _searchStringRepo.Select( node.Value.SearchEngineID, node.Value.RegionID); if (searchString != null) { string naturalResultParamString = string.Empty; if (node.Value.IsNatural) { naturalResultParamString = searchString.NaturalResultParamString; } string UULE = string.Empty; if (node.Value.CityID > 0) { LocalUULE localUULE = _localUULERepo.Select(node.Value.CityID); if (localUULE != null) { UULE = $"&uule={localUULE.UULE}"; } } node.Value.SearchString = $"{searchString.SearchEngine}{searchString.SearchEngineURL}{naturalResultParamString}{UULE}"; } else { // mark the node for removal, no // search string exists for the // seid, reid tuple pipelinedCrawlDescription.MarkedForRemoval.Add(node); } node = node.Next; } if (_connection != null) { _connection.Flow(pipelinedCrawlDescription); } return(pipelinedCrawlDescription); }
public LocalUULE Select(int cityID) { using (Transaction transaction = _engine.GetTransaction()) { DBreezeObject <LocalUULE> obj = transaction .Select <byte[], byte[]>(_table, 2.ToIndex(cityID)) .ObjectGet <LocalUULE>(); if (obj != null) { LocalUULE entity = obj.Entity; return(entity); } return(null); } }
public IEnumerable <LocalUULE> SelectAll() { using (Transaction transaction = _engine.GetTransaction()) { List <LocalUULE> entities = new List <LocalUULE>(); IEnumerable <Row <byte[], byte[]> > rows = transaction .SelectForwardFromTo <byte[], byte[]>( _table, 1.ToIndex(int.MinValue), true, 1.ToIndex(int.MaxValue), true); foreach (Row <byte[], byte[]> row in rows) { DBreezeObject <LocalUULE> obj = row.ObjectGet <LocalUULE>(); if (obj != null) { LocalUULE entity = obj.Entity; entities.Add(entity); } } return(entities); } }