LCOV - code coverage report
Current view: top level - Azure/Cqrs.Azure.DocumentDb/Repositories - AzureRepository.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 4 0.0 %
Date: 2017-07-26

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="cdmdotnet Limited">
       4             : // //   Copyright cdmdotnet Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System;
      10             : using System.Linq;
      11             : using System.Linq.Expressions;
      12             : using Cqrs.Azure.DocumentDb.DataStores;
      13             : using Cqrs.Azure.DocumentDb.Entities;
      14             : using Cqrs.DataStores;
      15             : using Cqrs.Repositories;
      16             : using Cqrs.Repositories.Queries;
      17             : 
      18             : namespace Cqrs.Azure.DocumentDb.Repositories
      19             : {
      20             :         public abstract class AzureRepository<TQueryStrategy, TQueryBuilder, TData> :  Repository<TQueryStrategy, TQueryBuilder, TData>
      21             :                 where TQueryStrategy : IQueryStrategy
      22             :                 where TQueryBuilder : QueryBuilder<TQueryStrategy, TData>
      23             :                 where TData : AzureDocumentDbEntity
      24           0 :         {
      25           0 :                 protected AzureRepository(Func<IDataStore<TData>> createDataStoreFunction, TQueryBuilder queryBuilder)
      26             :                         :base(createDataStoreFunction, queryBuilder)
      27             :                 {
      28             :                 }
      29             : 
      30           0 :                 public override TData Load(Guid rsn, bool throwExceptionOnMissingEntity = true)
      31             :                 {
      32             :                         using (var dataStore = CreateDataStoreFunction() as AzureDocumentDbDataStore<TData>)
      33             :                         {
      34             :                                 if (throwExceptionOnMissingEntity)
      35             :                                         return dataStore.Single(entity => entity.Rsn == rsn);
      36             :                                 return dataStore.SingleOrDefault(entity => entity.Rsn == rsn);
      37             :                         }
      38             :                 }
      39             : 
      40           0 :                 protected override IQueryable<TData> CreateQueryable(Expression<Func<TData, bool>> predicate)
      41             :                 {
      42             :                         return CreateDataStoreFunction().AsQueryable().Where(predicate);
      43             :                 }
      44             : 
      45             :         }
      46             : }

Generated by: LCOV version 1.10