Exemplo n.º 1
0
 public PersonService(
     IWritableRepository <int, DomainPerson> personRepository,
     IAgeGroupService ageGroupService
     )
 {
     this.personRepository = personRepository;
     this.ageGroupService  = ageGroupService;
 }
        public void SetUp()
        {
            _product = new Product("Test", "A product created during an intergration test", 19.99);
            _productRepository = ContainerSpecification.Resolve<IWritableRepository<Product>>();
            _database = ContainerSpecification.Resolve<MongoDatabase>();
            _collectionName = typeof (Product).Name.ToLower();

            _collection = _database.GetCollection<Product>(_collectionName);
        }
Exemplo n.º 3
0
        public MainProfiler()
        {
            InitializeComponent();
            this.InitializeBindings();

            traceServer = null;

            var repository = new MemoryRepository();

            this.traceServices = new TraceServices(repository);
            this.repository    = repository;
            commandParametersBindingSource.DataSource = parameter;

            parameter.ServerStatusChanged += new Action <bool>(parameter_ServerStatusChanged);
        }
 /// <summary>
 /// Create a new repo decorator.
 /// </summary>
 /// <param name="innerRepository">The repository to be decorated</param>
 /// <param name="now">A datetime service that provides the time the entity was updated</param>
 /// <param name="currentUserAccessor">An accessor for the current user's properties</param>
 internal AuditableRepositoryDecorator(IWritableRepository <T> innerRepository, IDateTimeService now, ICurrentUserAccessor currentUserAccessor) : base(innerRepository)
 {
     _now = now;
     _currentUserAccessor = currentUserAccessor;
 }
 public TraceServerService(IWritableRepository repo)
 {
     this.repo = repo;
 }
Exemplo n.º 6
0
 public EmptyDecorator(IWritableRepository <TestEntity> innerRepository) : base(innerRepository)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Decorate the repository's Remove methods with logic to mark the entity as deleted.
 /// </summary>
 /// <param name="innerRepository">The repository to decorate.</param>
 /// <param name="now">A service to get the current datetime</param>
 /// <param name="currentUserAccessor">A service to get the current user</param>
 /// <typeparam name="T">The type of entity stored in the repository</typeparam>
 /// <returns>The decorated repository</returns>
 public static IWritableRepository <T> AddSoftDeletabilityWithOffset <T>(this IWritableRepository <T> innerRepository, IDateTimeService now, ICurrentUserAccessor currentUserAccessor)
     where T : class, ISoftDeletableWithOffset
 {
     return(new SoftDeletableWithOffsetRepositoryDecorator <T>(innerRepository, now, currentUserAccessor));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Decorate the repository's Add and Update methods with logic to update the audit properties of the entity.
 /// </summary>
 /// <param name="innerRepository">The repository to decorate.</param>
 /// <param name="now">A service to get the current datetime</param>
 /// <param name="currentUserAccessor">A service to get the current user</param>
 /// <typeparam name="T">The type of entity stored in the repository</typeparam>
 /// <returns>The decorated repository</returns>
 public static IWritableRepository <T> AddAuditability <T>(this IWritableRepository <T> innerRepository, IDateTimeService now, ICurrentUserAccessor currentUserAccessor)
     where T : class, IAuditable
 {
     return(new AuditableRepositoryDecorator <T>(innerRepository, now, currentUserAccessor));
 }
Exemplo n.º 9
0
 public ClearMemoryTracesCommand(IAppMainView view, IWritableRepository memoryRepository)
 {
     this.view             = view;
     this.memoryRepository = memoryRepository;
 }
 public DomainUnitOfWork(DbContextOptions <DomainUnitOfWork> options, IRequestContext requestContext)
     : base(options, requestContext)
 {
     Customers = new WritableBaseRepository <Customer, Guid>(this);
     Projects  = new WritableBaseRepository <Project, Guid>(this);
 }
Exemplo n.º 11
0
 /// <summary>checkUserPermissions is set to false.</summary>
 public static void Delete <TEntity>(this IWritableRepository <TEntity> repository, params TEntity[] deleteIds)
     where TEntity : class
 {
     repository.Save(null, null, deleteIds, false);
 }
Exemplo n.º 12
0
 public static void Delete <TEntity>(this IWritableRepository <TEntity> repository, IEnumerable <TEntity> deleteIds, bool checkUserPermissions = false)
     where TEntity : class
 {
     repository.Save(null, null, deleteIds, checkUserPermissions);
 }
Exemplo n.º 13
0
 /// <summary>checkUserPermissions is set to false.</summary>
 public static void Update <TEntity>(this IWritableRepository <TEntity> repository, params TEntity[] updateNew)
     where TEntity : class
 {
     repository.Save(null, updateNew, null, false);
 }
Exemplo n.º 14
0
 public static void Update <TEntity>(this IWritableRepository <TEntity> repository, IEnumerable <TEntity> updateNew, bool checkUserPermissions = false)
     where TEntity : class
 {
     repository.Save(null, updateNew, null, checkUserPermissions);
 }
Exemplo n.º 15
0
 /// <summary>checkUserPermissions is set to false.</summary>
 public static void Insert <TEntity>(this IWritableRepository <TEntity> repository, params TEntity[] insertNew)
     where TEntity : class
 {
     repository.Save(insertNew, null, null, false);
 }
 /// <summary>
 /// Create a new repository decorator.
 /// </summary>
 /// <param name="innerRepository">The inner repository</param>
 protected RepositoryDecoratorAbstract(IWritableRepository <T> innerRepository)
 {
     InnerRepository = innerRepository;
 }