Exemple #1
0
 public WriteTransaction(
     RelationalTransactionRegistry registry,
     RetriableOperation operationsToRetry,
     IRelationalStoreConfiguration configuration,
     IKeyAllocator keyAllocator,
     string name = null
     ) : base(registry, operationsToRetry, configuration, name)
 {
     this.configuration = configuration;
     this.keyAllocator  = keyAllocator;
     builder            = new DataModificationQueryBuilder(configuration, AllocateId);
 }
 public DeleteQueryBuilder(
     IUniqueParameterNameGenerator uniqueParameterNameGenerator,
     DataModificationQueryBuilder queryBuilder,
     IWriteQueryExecutor queryExecutor,
     IEnumerable <IWhereClause> whereClauses = null,
     CommandParameterValues parameterValues  = null)
 {
     this.uniqueParameterNameGenerator = uniqueParameterNameGenerator;
     this.queryBuilder    = queryBuilder;
     this.queryExecutor   = queryExecutor;
     this.whereClauses    = whereClauses ?? new List <IWhereClause>();
     this.parameterValues = parameterValues ?? new CommandParameterValues();
 }
        public DataModificationQueryBuilderFixture()
        {
            var configuration = new RelationalStoreConfiguration("");

            configuration.DocumentSerializer = new NewtonsoftDocumentSerializer(configuration);
            configuration.DocumentMaps.Register(
                new TestDocumentMap(),
                new TestDocumentWithRelatedDocumentsMap(),
                new TestDocumentWithMultipleRelatedDocumentsMap(),
                new OtherMap());
            builder = new DataModificationQueryBuilder(
                configuration,
                m => idAllocator()
                );
        }
        public DataModificationQueryBuilderFixture()
        {
            var mappings = new RelationalMappings();

            mappings.Install(new DocumentMap[]
            {
                new TestDocumentMap(),
                new TestDocumentWithRelatedDocumentsMap(),
                new TestDocumentWithMultipleRelatedDocumentsMap(),
                new OtherMap()
            });
            builder = new DataModificationQueryBuilder(
                mappings,
                new JsonSerializerSettings()
                );
        }
Exemple #5
0
        public RelationalTransaction(
            RelationalTransactionRegistry registry,
            RetriableOperation retriableOperation,
            IsolationLevel isolationLevel,
            ISqlCommandFactory sqlCommandFactory,
            JsonSerializerSettings jsonSerializerSettings,
            RelationalMappings mappings,
            IKeyAllocator keyAllocator,
            IRelatedDocumentStore relatedDocumentStore,
            string name = null,
            ObjectInitialisationOptions objectInitialisationOptions = ObjectInitialisationOptions.None
            )
        {
            this.registry               = registry;
            this.retriableOperation     = retriableOperation;
            this.sqlCommandFactory      = sqlCommandFactory;
            this.jsonSerializerSettings = jsonSerializerSettings;
            this.mappings               = mappings;
            this.keyAllocator           = keyAllocator;
            this.relatedDocumentStore   = relatedDocumentStore;
            this.name = name ?? Thread.CurrentThread.Name;
            this.objectInitialisationOptions = objectInitialisationOptions;
            if (string.IsNullOrEmpty(name))
            {
                this.name = "<unknown>";
            }

            dataModificationQueryBuilder = new DataModificationQueryBuilder(mappings, jsonSerializerSettings);

            try
            {
                registry.Add(this);
                connection = new SqlConnection(registry.ConnectionString);
                connection.OpenWithRetry();
                transaction = connection.BeginTransaction(isolationLevel);
            }
            catch
            {
                Dispose();
                throw;
            }
        }