コード例 #1
0
 public QueryFactory(
     ITypeManager typeManager,
     IIdAccessor idAccessor)
 {
     _typeManager = typeManager;
     _idAccessor  = idAccessor;
 }
コード例 #2
0
 public LoadPipeline(CouchDb couchDb,
                     IIdManager idManager,
                     IIdAccessor idAccessor,
                     IRevisionAccessor revisionAccessor)
 {
     _couchDb          = couchDb;
     _idManager        = idManager;
     _idAccessor       = idAccessor;
     _revisionAccessor = revisionAccessor;
 }
コード例 #3
0
ファイル: Serializer.cs プロジェクト: dbones-labs/arm-chair
        public Serializer(IIdAccessor idAccessor, IRevisionAccessor revisionAccessor)
        {
            var factory = new SerializerSettingsFactory();

            factory.SetUpDocumentContractResolver(idAccessor, revisionAccessor);
            var settings = factory.Create();

            _settings       = settings;
            _jsonSerializer = JsonSerializer.Create(_settings);
        }
コード例 #4
0
 public QueryProvider(ITypeManager typeManager, IIdAccessor idAccessor, ISession session, IEnumerable <string> index = null)
 {
     _sessionContext = new SessionContext()
     {
         TypeManager = typeManager,
         IdAccessor  = idAccessor
     };
     _session = session;
     _index   = index;
 }
コード例 #5
0
        /// <summary>
        /// create an instance of the contract resolver to handle Counch DB documents
        /// </summary>
        public DocumentContractResolver(IIdAccessor idAccessor, IRevisionAccessor revisionAccessor) : base()
        {
            _baseOverride = new BaseOverride(idAccessor, revisionAccessor);

            var naming = new LocalCamelCaseNamingStrategy
            {
                OverrideSpecifiedNames = true,
                ProcessDictionaryKeys  = true
            };

            NamingStrategy = naming;
        }
コード例 #6
0
ファイル: IdAccessor.cs プロジェクト: dbones-labs/arm-chair
 /// <summary>
 /// Set the Id directly against a Type
 /// </summary>
 /// <typeparam name="T">the tpye which to set the Id against</typeparam>
 /// <param name="idAccessor">the idaccessor instance</param>
 /// <param name="field">Id Field</param>
 public static void SetUpId <T>(this IIdAccessor idAccessor, FieldInfo field)
 {
     if (idAccessor == null)
     {
         throw new ArgumentNullException(nameof(idAccessor));
     }
     if (field == null)
     {
         throw new ArgumentNullException(nameof(field));
     }
     idAccessor.SetUpId(typeof(T), field);
 }
コード例 #7
0
        public StructureSchema(IStructureType type, IIdAccessor idAccessor = null, IConcurrencyTokenAccessor concurrencyTokenAccessor = null, ITimeStampAccessor timeStampAccessor = null, ICollection <IIndexAccessor> indexAccessors = null)
        {
            Ensure.That(type, "type").IsNotNull();

            Type       = type;
            IdAccessor = idAccessor;
            ConcurrencyTokenAccessor = concurrencyTokenAccessor;
            TimeStampAccessor        = timeStampAccessor;

            IndexAccessors = indexAccessors != null
                ? new List <IIndexAccessor>(indexAccessors)
                : new List <IIndexAccessor>();
        }
コード例 #8
0
        public StructureSchema(IStructureType type, IIdAccessor idAccessor = null, IConcurrencyTokenAccessor concurrencyTokenAccessor = null, ITimeStampAccessor timeStampAccessor = null, ICollection<IIndexAccessor> indexAccessors = null)
        {
            Ensure.That(type, "type").IsNotNull();

            Type = type;
            IdAccessor = idAccessor;
            ConcurrencyTokenAccessor = concurrencyTokenAccessor;
            TimeStampAccessor = timeStampAccessor;

            IndexAccessors = indexAccessors != null 
                ? new List<IIndexAccessor>(indexAccessors)
                : new List<IIndexAccessor>();
        }
コード例 #9
0
ファイル: IdAccessor.cs プロジェクト: dbones-labs/arm-chair
        /*
         * public static void SetUpId<T>(FieldMeta field)
         * {
         *  if (field == null) throw new ArgumentNullException(nameof(field));
         *  _typeIdFields.Add(typeof(T), field);
         * }
         */


        /// <summary>
        /// Set the Id directly against a Type
        /// </summary>
        /// <typeparam name="T">the tpye which to set the Id against</typeparam>
        /// <param name="idAccessor">the idaccessor instance</param>
        /// <param name="fieldName">name of the Id field</param>
        public static void SetUpId <T>(this IIdAccessor idAccessor, string fieldName)
        {
            if (idAccessor == null)
            {
                throw new ArgumentNullException(nameof(idAccessor));
            }
            if (fieldName == null)
            {
                throw new ArgumentNullException(nameof(fieldName));
            }
            FieldMeta fieldInfo = typeof(T).GetTypeMeta().Fields.FirstOrDefault(x => x.Name == fieldName);

            SetUpId <T>(idAccessor, fieldInfo?.FieldInfo);
        }
コード例 #10
0
ファイル: IdAccessor.cs プロジェクト: dbones-labs/arm-chair
        /// <summary>
        /// Set the Id directly against a Type
        /// </summary>
        /// <typeparam name="T">the tpye which to set the Id against</typeparam>
        /// <param name="idAccessor">the id accessor instance</param>
        /// <param name="property">The Id property, this will then use the Auto back field</param>
        public static void SetUpId <T>(this IIdAccessor idAccessor, Expression <Func <T, object> > property)
        {
            if (idAccessor == null)
            {
                throw new ArgumentNullException(nameof(idAccessor));
            }
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }
            string name             = ((MemberExpression)property.Body).Member.Name;
            string backingFieldName = GetPropertyBackingFieldName(name);

            SetUpId <T>(idAccessor, backingFieldName);
        }
コード例 #11
0
        public StructureSchema(string name, IIdAccessor idAccessor, IEnumerable<IIndexAccessor> indexAccessors = null)
        {
            if (string.IsNullOrWhiteSpace(name))
                throw new ArgumentNullException("name");

            if(idAccessor == null)
                throw new ArgumentNullException("idAccessor");

            Name = name;
            Hash = SisoDbEnvironment.HashService.GenerateHash(name);
            IdAccessor = idAccessor;
            IndexAccessors = indexAccessors != null ? new List<IIndexAccessor>(indexAccessors)
                : new List<IIndexAccessor>();
            UniqueIndexAccessors = indexAccessors != null ? new List<IIndexAccessor>(indexAccessors.Where(iac => iac.IsUnique))
                : new List<IIndexAccessor>();
        }
コード例 #12
0
ファイル: Session.cs プロジェクト: dbones-labs/arm-chair
 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;
 }
コード例 #13
0
 public TransactionCoordinator(CouchDb couchDb, IIdAccessor idAccessor, IRevisionAccessor revisionAccessor)
 {
     _couchDb          = couchDb;
     _idAccessor       = idAccessor;
     _revisionAccessor = revisionAccessor;
 }
コード例 #14
0
 public LoadManyFromDatabaseAction(CouchDb couchDb, IIdManager idManager, IIdAccessor idAccessor)
 {
     _couchDb    = couchDb;
     _idManager  = idManager;
     _idAccessor = idAccessor;
 }
コード例 #15
0
 public void SetUpDocumentContractResolver(IIdAccessor idAccessor, IRevisionAccessor revisionAccessor)
 {
     ContractResolver = new DocumentContractResolver(idAccessor, revisionAccessor);
 }
コード例 #16
0
 /// <summary>
 /// create the base override, to support the Id and Revision
 /// </summary>
 /// <param name="idAccessor">the idaccessor use to find the Id</param>
 /// <param name="revisionAccessor">the revisionaccessor is used to find the revision</param>
 public BaseOverride(IIdAccessor idAccessor, IRevisionAccessor revisionAccessor)
 {
     _idAccessor       = idAccessor;
     _revisionAccessor = revisionAccessor;
 }