コード例 #1
0
 public IEnumerable <string> SignUp(string email, string password, string firstName, string lastName, string phone, string country, string pin, bool interestStayUpdate, bool interestHelpOthers, bool interestConnectExpert, bool expert, string expertiseDomain, string organizationType, string organizationName, string jobTitle)
 {
     using (var db = _dbContext.GetDbContext())
     {
         return(db.USP_Account_InsertUpdate(email, password, firstName, lastName, phone, country, pin, interestStayUpdate, interestHelpOthers, interestConnectExpert, expert, expertiseDomain, organizationType, organizationName, jobTitle).ToList());
     }
 }
コード例 #2
0
        public void ExecuteResetProcessedLogFileJob(int logFileId)
        {
            using (IDbContext dbContext = _dbContextFactory.GetDbContext())
            {
                ISetLogFileUnprocessedCommand cmd = new SetLogFileUnprocessedCommand(dbContext
                                                                                     , new JobRegistrationService()
                                                                                     );

                dbContext.BeginTransaction();
                cmd.Execute(logFileId);
                dbContext.Commit();
            }
        }
コード例 #3
0
 public SuperMarketEntityDb(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
     // Buradan istediğiniz gibi EntityFramework'ü konfigure edebilirsiniz.
     //_dbContext.Configuration.LazyLoadingEnabled = false;
     //_dbContext.Configuration.ValidateOnSaveEnabled = false;
     //_dbContext.Configuration.ProxyCreationEnabled = false;
 }
コード例 #4
0
 public GenericRepository(IDbContextFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentNullException("factory");
     }
     this.Context = factory.GetDbContext();
 }
コード例 #5
0
        public RepositoryBase(IDbContextFactory contextFactory, IExecutionContext executionContext)
        {
            context = contextFactory.GetDbContext <TDbContext>();
            dbSet   = context.Set <TModel>();
            this.executionContext = executionContext;

            var modelInterfaces = typeof(TModel).GetInterfaces();
        }
コード例 #6
0
 public UnitOfWork(IDbContextFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentException("IDbContextFactory is null!.");
     }
     this._factory = factory;
     this._context = factory.GetDbContext();
 }
コード例 #7
0
 public GenericRepository(IDbContextFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentException("IDbContextFactory is null!.");
     }
     this._factory = factory;
     this._context = factory.GetDbContext();
 }
コード例 #8
0
        public virtual TContext GetDbContext()
        {
            var result = m_dbContextFactory.GetDbContext();

            if (GlobalConfiguration.Logger != null)
            {
                result.Database.Log = GlobalConfiguration.Logger;
            }
            return(result);
        }
コード例 #9
0
 public virtual void Delete(T item)
 {
     using (var ctx = dbContextFactory.GetDbContext())
     {
         ctx.Set <T>().Remove(item);
         ctx.SaveChanges();
     }
 }
コード例 #10
0
        protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
        {
            base.ConfigureRequestContainer(container, context);

            IAppSettings settings = container.Resolve <IAppSettings>();

            // register database context per request
            IDbContextFactory dbContextFactory = container.Resolve <IDbContextFactory>();

            container.Register <IDbContext>(dbContextFactory.GetDbContext());

            // validators
            container.Register <IUserValidator, UserValidator>();

            // repositories
            container.Register <ILogFileRepository, LogFileRepository>();
            container.Register <IProjectRepository, ProjectRepository>();
            container.Register <IRequestRepository, RequestRepository>();
            container.Register <IProjectRequestAggregateRepository, ProjectRequestAggregateRepository>();
            container.Register <IUserRepository, UserRepository>();

            // commands
            container.Register <ICreateLogFileCommand, CreateLogFileCommand>();
            container.Register <ICreateProjectCommand, CreateProjectCommand>();
            container.Register <ICreateProjectRequestAggregateCommand, CreateProjectRequestAggregateCommand>();
            container.Register <ICreateRequestBatchCommand, CreateRequestBatchCommand>();
            container.Register <ICreateUserCommand, CreateUserCommand>();
            container.Register <IDeleteLogFileCommand, DeleteLogFileCommand>();
            container.Register <IDeleteProjectCommand, DeleteProjectCommand>();
            container.Register <IDeleteProjectRequestAggregateCommand, DeleteProjectRequestAggregateCommand>();
            container.Register <IDeleteUserCommand, DeleteUserCommand>();
            container.Register <IProcessLogFileCommand, ProcessLogFileCommand>();
            container.Register <ISetLogFileUnprocessedCommand, SetLogFileUnprocessedCommand>();
            container.Register <IUpdateUserPasswordCommand, UpdateUserPasswordCommand>();

            // services
            container.Register <IJobRegistrationService, JobRegistrationService>();
            container.Register <IUserService, UserService>();

            container.Register <IUserMapper, UserMapper>();
        }
コード例 #11
0
 public GenericRepository(IDbContextFactory contextFactory)
 {
     _context = contextFactory.GetDbContext <TDbContext>();
     _dbSet   = _context.Set <TEntity>();
 }
コード例 #12
0
 public CountryContext(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
 }
コード例 #13
0
 public SqlSchemaInitializer(IDbContextFactory <TContext> dbContextFactory)
 {
     m_DbContext = dbContextFactory.GetDbContext();
 }
コード例 #14
0
 public CountryContext(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
 }
コード例 #15
0
 public UserContext(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
 }
コード例 #16
0
ファイル: UnitOfWork.cs プロジェクト: MiuuOnline/WebCenter
 /// <summary>
 /// NOTE: repository getters instantiate repositories as needed (lazily)...
 ///       i wish I knew of IoC "way" of wiring up repository getters...
 /// </summary>
 /// <param name="dbContextFactory"></param>
 public UnitOfWork(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
 }
コード例 #17
0
 public PostContext(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
 }
コード例 #18
0
ファイル: UnitOfWork.cs プロジェクト: stone1314/MyDemo
 public UnitOfWork(IDbContextFactory dbFactory)
 {
     _dbContext = dbFactory.GetDbContext();
 }
コード例 #19
0
 public PostContext(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
 }
コード例 #20
0
 public override SchemaDbContext GetDbContext()
 {
     return(m_DbContextFactory.GetDbContext());
 }
コード例 #21
0
ファイル: SysConfigService.cs プロジェクト: hybirdtheory/stm
 public SysConfigService(IDbContextFactory dbContextFactory, RepositoryOptions <SysConfigService> options)
 {
     _dbContext = dbContextFactory.GetDbContext(options.DbName);
 }
コード例 #22
0
ファイル: ControlFactory.cs プロジェクト: hesi726/hongbo
 /// <summary>
 /// 带有 DbContext子类 接口工厂方法的 构造函数;
 /// </summary>
 /// <param name="t"></param>
 public ControlFactory(IDbContextFactory <K> t) : this(() => { return(t.GetDbContext()); })
 {
 }
コード例 #23
0
 public UserContext(IDbContextFactory dbContextFactory)
 {
     _dbContext = dbContextFactory.GetDbContext();
 }
コード例 #24
0
 public UnitOfWork(IDbContextFactory contextFactory)
 {
     _context = contextFactory.GetDbContext <TDbContext>();
 }
コード例 #25
0
 public EFDbContext GetDbContext()
 {
     return(factory.GetDbContext());
 }
コード例 #26
0
        /// <summary>
        /// Gets the registration by email.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <returns></returns>
        /// <exception cref="ApplicationException">Repository GetRegistrationByEmail</exception>
        public IUserRegistration GetRegistrationByEmail(string email)
        {
            try
            {
                using (
                    var dbContext = (PitalyticsEntities)dbContextFactory.GetDbContext())
                {
                    var aRecord = AccountQueries.getRegistrationByEmail(dbContext, email);

                    return(aRecord);
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException("Repository GetRegistrationByEmail", e);
            }
        }
コード例 #27
0
 public DelRepo(IDbContextFactory factory)
 {
     this.mDbContext = factory.GetDbContext();
 }
コード例 #28
0
 /// <summary>
 /// 設定此Unit of work(UOF)的Context。
 /// </summary>
 /// <param name="context">設定UOF的context</param>
 public EFUnitOfWork(IDbContextFactory databaseFactory)
 {
     _databaseFactory = databaseFactory;
     _context         = _context ?? _databaseFactory.GetDbContext();
 }
コード例 #29
0
 public RepositoryBase(IDbContextFactory factory) : this(factory.GetDbContext())
 {
 }
コード例 #30
0
 public DbBasedAuthService(IDbContextFactory dbContextFactory, RepositoryOptions <DbBasedAuthService> options)
 {
     _dbContext = dbContextFactory.GetDbContext(options.DbName);
 }