예제 #1
0
 /// <summary>
 /// Creates a StockService.
 /// </summary>
 /// <param name="entityQuerySource">EntityQuerySource to run queries against the persistent storage.</param>
 /// <param name="entityRepositoryFactory">EntityRepositoryFactory to make changes to the persistent storage.</param>
 /// <param name="accountTransactionsAggregator"></param>
 /// <param name="stockInfoService"></param>
 public StockService(IEntityQuerySource entityQuerySource, IEntityRepositoryFactory entityRepositoryFactory, AccountTransactionsAggregator accountTransactionsAggregator, IStockInfoService stockInfoService)
 {
     _entityQuerySource             = entityQuerySource;
     _entityRepositoryFactory       = entityRepositoryFactory;
     _stockInfoService              = stockInfoService;
     _accountTransactionsAggregator = accountTransactionsAggregator;
 }
        /// <summary>
        /// Queries an entity by its identifier.
        /// </summary>
        /// <typeparam name="TEntity">Type of the entity to retreive.</typeparam>
        /// <param name="context">Query Source to use for retreiving the entity.</param>
        /// <param name="id">Identifier of the entity to retreive.</param>
        /// <returns>The entity of the specified type with the specified identifier.</returns>
        public static Task <TEntity> GetById <TEntity>(this IEntityQuerySource context, int id)
            where TEntity : EntityBase
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            return(context.FirstOrDefault(q => q.Get <TEntity>().Where(x => x.Id == id)));
        }
예제 #3
0
 /// <summary>
 /// Creates a StockImportService.
 /// </summary>
 /// <param name="entityQuerySource">EntityQuerySource to run queries against the persistent storage.</param>
 /// <param name="entityRepositoryFactory">EntityRepositoryFactory to make changes to the persistent storage.</param>
 /// <param name="stockQueryService">Service to query the current list of available stocks.</param>
 public StockImportService(IEntityQuerySource entityQuerySource, IEntityRepositoryFactory entityRepositoryFactory, IStockQueryService stockQueryService)
 {
     _entityQuerySource       = entityQuerySource;
     _entityRepositoryFactory = entityRepositoryFactory;
     _stockQueryService       = stockQueryService;
 }
 /// <summary>
 /// Creates an AccountTransactionsAggregator.
 /// </summary>
 /// <param name="entityQuerySource">EntityQuerySource to run queries against the persistent storage.</param>
 public AccountTransactionsAggregator(IEntityQuerySource entityQuerySource)
 {
     _entityQuerySource = entityQuerySource;
 }
예제 #5
0
 /// <summary>
 /// Creates an AccountService.
 /// </summary>
 /// <param name="entityQuerySource">EntityQuerySource to run queries against the persistent storage.</param>
 /// <param name="entityRepositoryFactory">EntityRepositoryFactory to make changes to the persistent storage.</param>
 public AccountService(IEntityQuerySource entityQuerySource, IEntityRepositoryFactory entityRepositoryFactory)
 {
     _entityQuerySource       = entityQuerySource;
     _entityRepositoryFactory = entityRepositoryFactory;
 }