예제 #1
0
 public CreateUserHandler(IMainDbContext mainDbContext, IMapper mapper, ISecurityService securityService, IUserRepository userRepository)
 {
     _dbContext       = mainDbContext;
     _mapper          = mapper;
     _securityService = securityService;
     _userRepository  = userRepository;
 }
예제 #2
0
 /// <summary>
 /// Disposes database context.
 /// </summary>
 public virtual void Dispose()
 {
     if (_context != null)
     {
         _context.Dispose();
         _context = null;
     }
 }
예제 #3
0
 public GenerateTokenHandler(IMainDbContext mainDbContext, IMapper mapper,
                             ITokenConfiguration tokenConfiguration, ISignInConfiguration signInConfiguration)
 {
     _mainDbContext       = mainDbContext;
     _mapper              = mapper;
     _tokenHandler        = new JwtSecurityTokenHandler();
     _tokenConfiguration  = tokenConfiguration;
     _signInConfiguration = signInConfiguration;
 }
예제 #4
0
 public AuthenticateUserHandler(IMainDbContext mainDbContext, IMapper mapper,
                                ITokenConfiguration tokenConfiguration, ISignInConfiguration signInConfiguration,
                                IMediator mediator)
 {
     _mainDbContext       = mainDbContext;
     _mapper              = mapper;
     _tokenConfiguration  = tokenConfiguration;
     _signInConfiguration = signInConfiguration;
     _mediator            = mediator;
 }
예제 #5
0
        /// <summary>
        /// Ensure collections created
        /// </summary>
        private static void CreateCollections(IMainDbContext dbContext)
        {
            var collections = dbContext.Collections();

            if (!collections.Has <Board>())
            {
                dbContext.CreateCollection <Board>();
            }

            if (!collections.Has <Card>())
            {
                dbContext.CreateCollection <Card>();
            }

            if (!collections.Has <Task>())
            {
                dbContext.CreateCollection <Task>();
            }

            if (!collections.Has <Organization>())
            {
                dbContext.CreateCollection <Organization>();
            }

            if (!collections.Has <Project>())
            {
                dbContext.CreateCollection <Project>();
            }

            if (!collections.Has <User>())
            {
                dbContext.CreateCollection <User>();
            }

            if (!collections.Has <ApplicationRole>(name: "Roles"))
            {
                dbContext.CreateCollection <ApplicationRole>(name: "Roles");
            }
        }
예제 #6
0
        /// <summary>
        /// Calls the protected Dispose method.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        public void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // free other managed objects that implement
                // IDisposable only

                try
                {
                    if (_objectContext != null && _objectContext.Connection.State == ConnectionState.Open)
                    {
                        _objectContext.Connection.Close();
                    }
                }
                catch (ObjectDisposedException ex)
                {
                    log.Error(ex);
                    // do nothing, the objectContext has already been disposed
                }

                if (_dataContext != null)
                {
                    _dataContext.Dispose();
                    _dataContext = null;
                }
            }

            // release any unmanaged objects
            // set the object references to null

            _disposed = true;
        }
예제 #7
0
 public TaskRepository(IMainDbContext dbContext) : base(dbContext)
 {
 }
예제 #8
0
 public RepositoryBase(IMainDbContext mainDbContext)
 {
     _mainDbContext = mainDbContext;
 }
예제 #9
0
 public CurrencyRepository(IMainDbContext context)
 {
     mainDbContext = context;
 }
예제 #10
0
 public CreditCardRepository(IMainDbContext context)
 {
     mainDbContext = context;
 }
 public OrganizationRepository(IMainDbContext dbContext) : base(dbContext)
 {
     _organizations = dbContext.GetCollection <Organization>();;
 }
예제 #12
0
 public AddressRepository(IMainDbContext context)
 {
     mainDbContext = context;
 }
예제 #13
0
        /// <summary>
        /// Create index for collections
        /// </summary>
        private static void CreateIndexes(IMainDbContext dbContext)
        {
            #region Task Indexs

            dbContext.GetCollection <Task>().Indexes.CreateOneAsync(new CreateIndexModel <Task>(Builders <Task> .IndexKeys.Ascending(x => x.Id), new CreateIndexOptions()
            {
                Name = "Id", Unique = true
            }));
            dbContext.GetCollection <Task>().Indexes.CreateOneAsync(new CreateIndexModel <Task>(Builders <Task> .IndexKeys.Ascending(x => x.CardId), new CreateIndexOptions()
            {
                Name = "CardId"
            }));


            #endregion

            #region Card Indexs

            dbContext.GetCollection <Card>().Indexes.CreateOneAsync(new CreateIndexModel <Card>(Builders <Card> .IndexKeys.Ascending(x => x.Id), new CreateIndexOptions()
            {
                Name = "Id", Unique = true
            }));
            dbContext.GetCollection <Card>().Indexes.CreateOneAsync(new CreateIndexModel <Card>(Builders <Card> .IndexKeys.Ascending(x => x.BoardId), new CreateIndexOptions()
            {
                Name = "BoardId"
            }));


            #endregion

            #region Board Indexs

            dbContext.GetCollection <Board>().Indexes.CreateOneAsync(new CreateIndexModel <Board>(Builders <Board> .IndexKeys.Ascending(x => x.Id), new CreateIndexOptions()
            {
                Name = "Id", Unique = true
            }));
            dbContext.GetCollection <Board>().Indexes.CreateOneAsync(new CreateIndexModel <Board>(Builders <Board> .IndexKeys.Ascending(x => x.ProjectId), new CreateIndexOptions()
            {
                Name = "ProjectId"
            }));


            #endregion

            #region Project Indexs

            dbContext.GetCollection <Project>().Indexes.CreateOneAsync(new CreateIndexModel <Project>(Builders <Project> .IndexKeys.Ascending(x => x.Id), new CreateIndexOptions()
            {
                Name = "Id", Unique = true
            }));
            dbContext.GetCollection <Project>().Indexes.CreateOneAsync(new CreateIndexModel <Project>(Builders <Project> .IndexKeys.Ascending(x => x.OrganizationId), new CreateIndexOptions()
            {
                Name = "OrganizationId"
            }));


            #endregion

            #region Organization Indexs

            dbContext.GetCollection <Organization>().Indexes.CreateOneAsync(new CreateIndexModel <Organization>(Builders <Organization> .IndexKeys.Ascending(x => x.Id), new CreateIndexOptions()
            {
                Name = "Id", Unique = true
            }));
            dbContext.GetCollection <Organization>().Indexes.CreateOneAsync(new CreateIndexModel <Organization>(Builders <Organization> .IndexKeys.Ascending(x => x.UserId), new CreateIndexOptions()
            {
                Name = "UserId"
            }));


            #endregion

            #region User Indexs

            dbContext.GetCollection <User>().Indexes.CreateOneAsync(new CreateIndexModel <User>(Builders <User> .IndexKeys.Ascending(x => x.Id), new CreateIndexOptions()
            {
                Name = "Id", Unique = true
            }));
            dbContext.GetCollection <User>().Indexes.CreateOneAsync(new CreateIndexModel <User>(Builders <User> .IndexKeys.Ascending(x => x.UserName), new CreateIndexOptions()
            {
                Name = "UserName", Unique = true
            }));
            dbContext.GetCollection <User>().Indexes.CreateOneAsync(new CreateIndexModel <User>(Builders <User> .IndexKeys.Ascending(x => x.Email), new CreateIndexOptions()
            {
                Name = "Email"
            }));
            dbContext.GetCollection <User>().Indexes.CreateOneAsync(new CreateIndexModel <User>(Builders <User> .IndexKeys.Ascending(x => x.PhoneNumber), new CreateIndexOptions()
            {
                Name = "PhoneNumber", Unique = false
            }));
            dbContext.GetCollection <User>().Indexes.CreateOneAsync(new CreateIndexModel <User>(Builders <User> .IndexKeys.Ascending(x => x.DisplayName), new CreateIndexOptions()
            {
                Name = "DisplayName"
            }));


            #endregion

            #region ApplicationRole Indexs

            dbContext.GetCollection <ApplicationRole>(name: "Roles").Indexes.CreateOneAsync(new CreateIndexModel <ApplicationRole>(Builders <ApplicationRole> .IndexKeys.Ascending(x => x.Id), new CreateIndexOptions()
            {
                Name = "Id", Unique = true
            }));

            #endregion
        }
예제 #14
0
 public ResearchFellowRepository(IMainDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #15
0
 public DeleteUserHandler(IMainDbContext mainDbContext, IMapper mapper)
 {
     _mainDbContext = mainDbContext;
     _mapper        = mapper;
 }
예제 #16
0
 public LearningProgramRepository(IMainDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #17
0
 public DocumentService(IMainDbContext dbContext)
 {
     _dbContext = dbContext;
 }
예제 #18
0
 public CreateServiceCommandHandler(IMainDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #19
0
 public BaseRepository(IMainDbContext dbContext)
 {
     _dbContext = dbContext;
     _dbSet     = _dbContext.Set <TEntity>();
     _dbContext.Database.Log = x => log.Info(x);
 }
예제 #20
0
 public CreateUserHandler(IMainDbContext mainDbContext, IMapper mapper, ILogger <CreateUserHandler> logger)
 {
     _mainDbContext = mainDbContext;
     _mapper        = mapper;
     _logger        = logger;
 }
예제 #21
0
 public UpdateTenantCommandHandler(IMainDbContext context)
 {
     _context = context;
 }
예제 #22
0
 public Generic(IMainDbContext mainContext)
 {
     _mainContext = mainContext;
 }
예제 #23
0
        //private readonly IUserManager _userManager;

        public SeedSampleDataCommandHandler(IMainDbContext context)//, IUserManager userManager)
        {
            _context = context;
            //_userManager = userManager;
        }
예제 #24
0
 public CountryRepository(IMainDbContext context)
 {
     mainDbContext = context;
 }
예제 #25
0
 public DeleteEmployeeCommandHandler(IMainDbContext context)
 {
     _context = context;
 }
예제 #26
0
 public GetUsersListQueryHandler(IMainDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #27
0
 public UserLoginQueryHandler(IMainDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #28
0
 public CreateEmployeeCommandHandler(IMainDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #29
0
 public CreateTenantCommandHandler(IMainDbContext context, IMediator mediator)
 {
     _context  = context;
     _mediator = mediator;
 }
예제 #30
0
 public GetEmployeeListQueryHandler(IMainDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #31
0
 public UserRepository(IMainDbContext dbContext)
 {
 }