Contains arguments for the IndexChanged event of the IInMemoryIndex interface.
상속: System.EventArgs
예제 #1
0
        /// <summary>
        /// Handles the <see cref="IInMemoryIndex.IndexChanged" /> events.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event arguments.</param>
        protected void IndexChangedHandler(object sender, IndexChangedEventArgs e)
        {
            lock (this) {
                if (disposed)
                {
                    return;
                }

                switch (e.Change)
                {
                case IndexChangeType.IndexCleared:
                    InitDataStore(e.State);
                    break;

                case IndexChangeType.DocumentAdded:
                    if (!dataCorrupted)
                    {
                        IndexStorerResult result = SaveData(e.ChangeData, e.State);
                        e.Result = result;
                    }
                    break;

                case IndexChangeType.DocumentRemoved:
                    if (!dataCorrupted)
                    {
                        DeleteData(e.ChangeData, e.State);
                    }
                    break;

                default:
                    throw new NotSupportedException("Invalid Change Type");
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Takes care of firing the <see cref="IndexChanged" /> event.
 /// </summary>
 /// <param name="document">The affected document.</param>
 /// <param name="change">The change performed.</param>
 /// <param name="changeData">The dumped change data.</param>
 /// <param name="state">A state object that is passed to the IndexStorer SaveDate/DeleteData function.</param>
 /// <returns>The storage result or <c>null</c>.</returns>
 protected IndexStorerResult OnIndexChange(IDocument document, IndexChangeType change, DumpedChange changeData, object state)
 {
     if (IndexChanged != null)
     {
         IndexChangedEventArgs args = new IndexChangedEventArgs(document, change, changeData, state);
         IndexChanged(this, args);
         return(args.Result);
     }
     return(null);
 }
예제 #3
0
 /// <summary>
 /// Takes care of firing the <see cref="IndexChanged" /> event.
 /// </summary>
 /// <param name="document">The affected document.</param>
 /// <param name="change">The change performed.</param>
 /// <param name="changeData">The dumped change data.</param>
 /// <param name="state">A state object that is passed to the IndexStorer SaveDate/DeleteData function.</param>
 /// <returns>The storage result or <c>null</c>.</returns>
 protected IndexStorerResult OnIndexChange(IDocument document, IndexChangeType change, DumpedChange changeData, object state)
 {
     if(IndexChanged != null) {
         IndexChangedEventArgs args = new IndexChangedEventArgs(document, change, changeData, state);
         IndexChanged(this, args);
         return args.Result;
     }
     else return null;
 }
예제 #4
0
        /// <summary>
        /// Handles the <see cref="IInMemoryIndex.IndexChanged" /> events.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event arguments.</param>
        protected void IndexChangedHandler(object sender, IndexChangedEventArgs e)
        {
            lock(this) {
                if(disposed) return;

                switch(e.Change) {
                    case IndexChangeType.IndexCleared:
                        InitDataStore(e.State);
                        break;
                    case IndexChangeType.DocumentAdded:
                        if(!dataCorrupted) {
                            IndexStorerResult result = SaveData(e.ChangeData, e.State);
                            e.Result = result;
                        }
                        break;
                    case IndexChangeType.DocumentRemoved:
                        if(!dataCorrupted) DeleteData(e.ChangeData, e.State);
                        break;
                    default:
                        throw new NotSupportedException("Invalid Change Type");
                }
            }
        }