Ejemplo n.º 1
0
        public BulkInsertOperation(string database, IDocumentStore documentStore)
        {
            this.documentStore = documentStore;

            database = database ?? MultiDatabase.GetDatabaseName(documentStore.Url);

            generateEntityIdOnTheClient = new GenerateEntityIdOnTheClient(documentStore.Conventions, entity =>
                                                                          AsyncHelpers.RunSync(() => documentStore.Conventions.GenerateDocumentKeyAsync(database, entity)));

            // ReSharper disable once VirtualMemberCallInContructor
            Operation = GetBulkInsertOperation(database, documentStore.GetRequestExecuter(database));
        }
Ejemplo n.º 2
0
        internal Subscription(SubscriptionConnectionOptions options, IDocumentStore documentStore, DocumentConvention conventions, string dbName)
        {
            _options = options;
            if (_options.SubscriptionId == 0)
            {
                throw new ArgumentException("SubscriptionConnectionOptions must specify the SubscriptionId, but was set to zero.",
                                            nameof(options));
            }
            _store       = documentStore;
            _conventions = conventions;
            _dbName      = dbName;

            _generateEntityIdOnTheClient = new GenerateEntityIdOnTheClient(conventions,
                                                                           entity => { throw new InvalidOperationException("Shouldn't be generating new ids here"); });
        }