Пример #1
0
 public Session(
     LoadPipeline loadPipeline,
     QueryPipeline queryPipeline,
     CommitPipeline commitPipeline,
     QueryFactory queryFactory,
     IIdManager idManager,
     IIdAccessor idAccessor,
     ITrackingProvider tracking,
     ISessionCache sessionCache
     )
 {
     _sessionCache   = sessionCache;
     _loadPipeline   = loadPipeline;
     _queryPipeline  = queryPipeline;
     _commitPipeline = commitPipeline;
     _queryFactory   = queryFactory;
     _idManager      = idManager;
     _idAccessor     = idAccessor;
     _tracking       = tracking;
 }
Пример #2
0
        public Settings2(string databaseName, Connection connection, ILogger logger = null)
        {
            Logger = logger ?? new NullLogger();

            //global
            IdAccessor       = new IdAccessor();
            IdManager        = new ShortGuidIdManager();
            RevisionAccessor = new RevisionAccessor();
            TypeManager      = new TypeManager();

            Serializer = new Serializer(IdAccessor, RevisionAccessor);

            //query serializer
            var settings = new JsonSerializerSettings()
            {
                TypeNameHandling  = TypeNameHandling.None,
                NullValueHandling = NullValueHandling.Ignore,
                ContractResolver  =
                    new CamelCasePropertyNamesContractResolver()
                {
                    NamingStrategy = new LocalCamelCaseNamingStrategy(true)
                }
            };

            settings.Converters.Add(new OrderEnumConverter());
            QuerySerializer = new Serializer(settings);

            CouchDb                = new CouchDb(databaseName, connection, Serializer, QuerySerializer, Logger);
            QueryFactory           = new QueryFactory(TypeManager, IdAccessor);
            TransactionCoordinator = new TransactionCoordinator(CouchDb, IdAccessor, RevisionAccessor);

            LoadPipeline   = new LoadPipeline(CouchDb, IdManager, IdAccessor, RevisionAccessor);
            CommitPipeline = new CommitPipeline(CouchDb, IdManager, RevisionAccessor, TransactionCoordinator);
            QueryPipeline  = new QueryPipeline(CouchDb, IdManager, IdAccessor, RevisionAccessor);

            Hash = new ToLowerPassThroughHash();
        }