public void Insert(SpecialKeyword specialKeyword) { using (Transaction transaction = _engine.GetTransaction()) { Insert(transaction, specialKeyword); transaction.Commit(); } }
public SpecialKeyword Max() { using (Transaction transaction = _engine.GetTransaction()) { DBreezeObject <SpecialKeyword> obj = transaction.Max <byte[], byte[]>(_table) .ObjectGet <SpecialKeyword>(); if (obj != null) { SpecialKeyword entity = obj.Entity; return(entity); } return(null); } }
public SpecialKeyword Select(int searchEngineId, int regionId, int keywordId) { using (Transaction transaction = _engine.GetTransaction()) { DBreezeObject <SpecialKeyword> obj = transaction .Select <byte[], byte[]>( _table, 1.ToIndex(searchEngineId, regionId, keywordId)) .ObjectGet <SpecialKeyword>(); if (obj != null) { SpecialKeyword entity = obj.Entity; return(entity); } return(null); } }
/// <summary> /// Does an object insert and creates the necessary indexes for /// a keyword /// </summary> /// <param name="transaction"></param> /// <param name="specialKeyword"></param> private void Insert(Transaction transaction, SpecialKeyword specialKeyword) { transaction.ObjectInsert(_table, new DBreezeObject <SpecialKeyword> { Entity = specialKeyword, Indexes = new List <DBreezeIndex> { new DBreezeIndex(1, specialKeyword.SearchEngineID, specialKeyword.RegionID, specialKeyword.KeywordID) { PrimaryIndex = true }, new DBreezeIndex(2, specialKeyword.RowRevision) { AddPrimaryToTheEnd = false } } }); }
public IEnumerable <SpecialKeyword> SelectAll() { using (Transaction transaction = _engine.GetTransaction()) { List <SpecialKeyword> entities = new List <SpecialKeyword>(); IEnumerable <Row <byte[], byte[]> > rows = transaction .SelectForwardFromTo <byte[], byte[]>( _table, 1.ToIndex(int.MinValue, int.MinValue, int.MinValue), true, 1.ToIndex(int.MaxValue, int.MaxValue, int.MaxValue), true); foreach (Row <byte[], byte[]> row in rows) { DBreezeObject <SpecialKeyword> obj = row.ObjectGet <SpecialKeyword>(); if (obj != null) { SpecialKeyword entity = obj.Entity; entities.Add(entity); } } return(entities); } }