public static IEnumerable <TEntity> Read <TEntity, TParameter>(this IReadableRepository <TEntity> repository, TParameter parameter, bool preferQuery)
            where TEntity : class, IEntity
        {
            Type filterType = parameter != null?parameter.GetType() : typeof(TParameter);

            return(repository.Read(parameter, filterType, preferQuery));
        }
Exemplo n.º 2
0
        public static IEnumerable <TEntity> Load <TEntity, TParameter>(this IReadableRepository <TEntity> repository, TParameter parameter)
            where TEntity : class
        {
            Type filterType = parameter != null?parameter.GetType() : typeof(TParameter);

            return(repository.Load(parameter, filterType));
        }
 public static IRuleBuilderOptions <TRequest, TProperty> DoesNotExist <TRequest, TProperty, TEntity>(
     this IRuleBuilder <TRequest, TProperty> rule,
     Func <TProperty, ISpecification <TEntity> > spec,
     IReadableRepository <TEntity> repo)
     where TEntity : class
 {
     return(rule.SetValidator(new EntityExistenceValidator <TEntity, TProperty>(repo, spec, false, "{PropertyName} already exists.")));
 }
Exemplo n.º 4
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="personRepository"></param>
        /// <param name="repository"></param>
        public PersonRelationshipService(IRepository <Person> personRepository
                                         , IRepository <V_Person> repository)
        {
            _personRepository = personRepository;

            // 初始化只读仓储
            _readableRepository = repository.Constraint <IReadableRepository <V_Person> >();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Creates Exporter object.
 /// </summary>
 /// <param name="fromRepository">Input repository.</param>
 /// <param name="toRepository">Output repository.</param>
 /// <param name="logger">Logger.</param>
 /// <exception cref="ArgumentNullException">
 /// Thrown when fromRepository is null. -or- toRepository is null.
 /// </exception>
 public Exporter(
     IReadableRepository <string> fromRepository,
     IWriteableRepository <DTOSimpleURI> toRepository,
     ILogger logger = null)
 {
     FromRepository           = fromRepository ?? throw new ArgumentNullException("FromRepository must not be null");
     ToRepository             = toRepository ?? throw new ArgumentNullException("ToRepository must not be null");
     StringToURIMapper.Logger = logger;
 }
Exemplo n.º 6
0
        public IChildView GetMemoryTracesView(IReadableRepository repo)
        {
            var view = new TracesView
            {
                TabHeader = "Memory Traces"
            };

            view.SetServices(new TraceServices(repo));
            return(view);
        }
 public EntityExistenceValidator(
     IReadableRepository <TEntity> repository,
     Func <TProperty, ISpecification <TEntity> > specification,
     bool shouldExist,
     string errorMessage)
     : base(errorMessage)
 {
     _repository    = repository;
     _specification = specification;
     _shouldExist   = shouldExist;
 }
 public ProductUnitOfWork(
     ProductCommandContext commandContext,
     IMutatableRepository <Product> products,
     IMutatableRepository <Deal> deals,
     IReadableRepository <Product> readProducts)
 {
     _commandContext = commandContext;
     Products        = products;
     Deals           = deals;
     ReadProducts    = readProducts;
 }
Exemplo n.º 9
0
 public DivisionService(IReadableRepository <Division> repository)
 {
     this._repository = repository;
 }
Exemplo n.º 10
0
 public CRAttachmentService(IReadableRepository <Attachment> repository)
 {
     this.repository = repository;
 }
Exemplo n.º 11
0
 public BusinessFunctionService(IReadableRepository <BusinessFunction> repository)
 {
     this._repository = repository;
 }
Exemplo n.º 12
0
 public TraceServices(IReadableRepository repository)
 {
     this.Repository = repository;
 }
 public static IEnumerable <TEntity> Load <TEntity>(this IReadableRepository <TEntity> repository)
     where TEntity : class, IEntity
 {
     return(repository.Load(null, typeof(FilterAll)));
 }
 public EmailSendingforPendingCRServices(IReadableRepository <EmailSendingforPendingCR> repository)
 {
     this.repository = repository;
 }
Exemplo n.º 15
0
 public GetRoomQueryHandler(IReadableRepository <Room> roomRespository)
 {
     _roomRespository = roomRespository;
 }
Exemplo n.º 16
0
 public DepartmentService(IReadableRepository <Department> repository)
 {
     this._repository = repository;
 }
Exemplo n.º 17
0
 public ViewMemoryTracesCommand(IAppMainView view, IApplicationFactory factory, IReadableRepository memoryRepository)
 {
     this.view             = view;
     this.factory          = factory;
     this.memoryRepository = memoryRepository;
 }
Exemplo n.º 18
0
 public GetUserQueryHandler(IReadableRepository <User> repository)
 {
     _respository = repository;
 }
Exemplo n.º 19
0
 public static IEnumerable <TEntity> Load <TEntity>(this IReadableRepository <TEntity> repository, Expression <Func <TEntity, bool> > filter)
     where TEntity : class
 {
     return(repository.Load(filter, filter.GetType()));
 }