Пример #1
0
        /// <summary>
        /// Create a repository wtier for the CosmosDB container (SQL API)
        /// </summary>
        /// <typeparam name="TID">Type of the identifier</typeparam>
        /// <typeparam name="TValue">Type of the value stored in the collection</typeparam>
        /// <param name="repoName">Name of v</param>
        /// <returns>A writer to make writer operations</returns>
        public IWriteRepository <TID, TValue> GetRepositoryWriter <TID, TValue>(string repoName, IIdentifierStrategy <TID> strategy) where TValue : IIdentifiable <TID>
        {
            var cosmosContainer = _db.GetContainer(repoName);

            return(new CosmosContainerWriter <TID, TValue>(cosmosContainer, strategy));
        }
Пример #2
0
            public IWriteRepository <TID, TValue> GetRepositoryWriter <TID, TValue>(string repoName, IIdentifierStrategy <TID> strategy = null) where TValue : IIdentifiable <TID>
            {
                if (_repo == null)
                {
                    _repo = new MemoryRepository <TID, TValue>();
                }

                return(_repo as IWriteRepository <TID, TValue>);
            }
Пример #3
0
        /// <summary>
        /// Create a repository writer for the MongoDB collection
        /// </summary>
        /// <typeparam name="TID">Type of the identifier</typeparam>
        /// <typeparam name="TValue">Type of the value stored in the collection</typeparam>
        /// <param name="repoName">Name of MongoDB collection</param>
        /// <returns>A writer to make writer operations</returns>
        public IWriteRepository <TID, TValue> GetRepositoryWriter <TID, TValue>(string repoName, IIdentifierStrategy <TID> strategy = null) where TValue : IIdentifiable <TID>
        {
            var mongoCollection = _db.GetCollection <TValue>(repoName);

            return(new MongoCollectionWriter <TID, TValue>(mongoCollection));
        }
 internal CosmosContainerWriter(Container container, IIdentifierStrategy <TID> strategy) : base(container, strategy)
 {
 }
Пример #5
0
 internal CosmosContainer(Container container, IIdentifierStrategy <TID> strategy)
 {
     this.Container = container;
     _idStrategy    = strategy;
 }