public DocumentServiceContract(TContext context, IIndexService indexService, IIndexNotificationService notificationService) : base(context, indexService, notificationService) { Contract.Requires(context != null, "The context must not be null."); Contract.Requires(indexService != null, "The index service must not be null."); Contract.Requires(notificationService != null, "The notification service must not be null."); }
/// <summary> /// Initializes a new OfficeDocumentService. /// </summary> /// <param name="context">The context to query.</param> /// <param name="indexService">The index service.</param> /// <param name="notificationService">The notification service.</param> /// <param name="batchSize">The office dto batch size.</param> public OfficeDocumentService(EcaContext context, IIndexService indexService, IIndexNotificationService notificationService, int batchSize = 100) : base(context, indexService, notificationService, batchSize) { Contract.Requires(context != null, "The context must not be null."); Contract.Requires(indexService != null, "The index service must not be null."); Contract.Requires(notificationService != null, "The notification service must not be null."); }
protected override void Dispose(bool disposing) { if (disposing) { if (this.indexService is IDisposable) { (this.indexService as IDisposable).Dispose(); this.indexService = null; } if (this.notificationService is IDisposable) { (this.notificationService as IDisposable).Dispose(); this.notificationService = null; } } base.Dispose(disposing); }
/// <summary> /// Creates a new DocumentService with the given context to query, the index service to index documents with and /// the notification service to supply indexing updates to. /// </summary> /// <param name="context">The context to query.</param> /// <param name="indexService">The index service.</param> /// <param name="notificationService">The notification service.</param> /// <param name="batchSize">The batch size of documents to process at one time.</param> public DocumentService(TContext context, IIndexService indexService, IIndexNotificationService notificationService, int batchSize = DEFAULT_BATCH_SIZE) : base(context) { Contract.Requires(context != null, "The context must not be null."); Contract.Requires(indexService != null, "The index service must not be null."); Contract.Requires(notificationService != null, "The notification service must not be null."); this.indexService = indexService; this.batchSize = batchSize; this.notificationService = notificationService; context.Configuration.AutoDetectChangesEnabled = false; throwIfDocumentConfigurationNotFound = (config, t) => { if (config == null) { throw new NotSupportedException(String.Format("The document configuration for the type [{0}] was not found.", t)); } }; throwIfDocumentNotFound = (doc, documentTypeName, id) => { if (doc == null) { throw new ModelNotFoundException(String.Format("The {0} document with Id {1} was not found.", documentTypeName, id)); } }; }
public TestDocumentService(TestContext context, IIndexService indexService, IIndexNotificationService notificationService, int batchSize = DocumentService <TestContext, SimpleEntity> .DEFAULT_BATCH_SIZE) : base(context, indexService, notificationService, batchSize) { }