コード例 #1
0
 public EmailService(IDbContext context, Logger logger)
 {
     _ctx = context;
     _logger = logger;
     _applicationService = new ApplicationService(_ctx);
     _emailLogService = new EmailLogService(_ctx);
 }
コード例 #2
0
 public AnswersController(IDbContext dataContext)
 {
     if (dataContext != null)
     {
         this.dataContext = dataContext;
     }
 }
コード例 #3
0
ファイル: UserService.cs プロジェクト: xiongkailing/MyBlog
 public UserService(IDbContext dbContext, IRepository<User> repository,
     IRepository<UserRole> roleRepository)
 {
     this.dbContext = dbContext;
     this.repository = repository;
     this.roleRepository = roleRepository;
 }
コード例 #4
0
 public EmailService(IDbContext context, Logger logger, ApplicationService applicationService, EmailLogService emailLogService)
 {
     _ctx = context;
     _logger = logger;
     _applicationService = applicationService;
     _emailLogService = emailLogService;
 }
コード例 #5
0
 public ScoresController(IDbContext context, ICompiler compiler, IRunner runner, Participant participant = null)
 {
     _context = context;
     _compiler = compiler;
     _runner = runner;
     _participant = participant ?? GetCurrentParticipant();
 }
コード例 #6
0
 public void MyTestInitialize()
 {
     this._db = new R2DisasterContext();
     this._re = new EFRepository<PhyGeoDisaster>(this._db);
     //this._reGBCode = new EFRepository<GBCode>(this._db);
     this._service = new PhyGeoDisasterService(this._re);
 }
コード例 #7
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="dataProvider">Data provider</param>
 /// <param name="dbContext">Database Context</param>
 /// <param name="commonSettings">Common settings</param>
 public FulltextService(IDataProvider dataProvider, IDbContext dbContext,
     CommonSettings commonSettings)
 {
     this._dataProvider = dataProvider;
     this._dbContext = dbContext;
     this._commonSettings = commonSettings;
 }
コード例 #8
0
 public MsgRecordService(IRepository<MsgRecord> _msgRecordRepository, IRepository<ContactGroupSub> _contactGroupSubRepository
     , IDbContext _context)
 {
     msgRecordRepository = _msgRecordRepository;
     context = _context;
     contactGroupSubRepository = _contactGroupSubRepository;
 }
コード例 #9
0
        public GoogleFeedService(
			IRepository<GoogleProductRecord> gpRepository,
			IProductService productService,
			IManufacturerService manufacturerService,
			FroogleSettings settings,
			IMeasureService measureService,
			MeasureSettings measureSettings,
			IDbContext dbContext,
			AdminAreaSettings adminAreaSettings,
			ICurrencyService currencyService,
			ICommonServices services,
			IComponentContext ctx)
        {
            _gpRepository = gpRepository;
            _productService = productService;
            _manufacturerService = manufacturerService;
            Settings = settings;
            _measureService = measureService;
            _measureSettings = measureSettings;
            _dbContext = dbContext;
            _adminAreaSettings = adminAreaSettings;
            _currencyService = currencyService;
            _services = services;

            _helper = new FeedPluginHelper(ctx, "SmartStore.GoogleMerchantCenter", "SmartStore.GoogleMerchantCenter", () =>
            {
                return Settings as PromotionFeedSettings;
            });
        }
コード例 #10
0
ファイル: DefaultLogger.cs プロジェクト: mandocaesar/Mesinku
 public DefaultLogger(IRepository<Log> logRepository, IWebHelper webHelper, IDbContext dbContext, IWorkContext workContext)
 {
     this._logRepository = logRepository;
     this._webHelper = webHelper;
     this._dbContext = dbContext;
     this._workContext = workContext;
 }
コード例 #11
0
 public UserPanelController(IDbContext dbContext, ITechnicalStaffService technicalStaffService, IParticipationService participationService, ITechnicalStaffRoleService technicalStaffRoleService)
 {
     _dbContext = dbContext;
     _technicalStaffService = technicalStaffService;
     _participationService = participationService;
     _technicalStaffRoleService = technicalStaffRoleService;
 }
コード例 #12
0
 public RunController(IDbContext context, ICompiler compiler, IRunner runner, Participant participant = null)
 {
     _context = context;
     _compiler = compiler;
     _runner = runner;
     _participant = participant == null ? GetCurrentParticipant() : participant;
 }
コード例 #13
0
        private void SetupForGetMessages()
        {
            var list1 = new List<Message>()
            {
                new Message()
                {
                    Body = "B1"
                },
                new Message()
                {
                    Body = "B2"
                }
            }.AsQueryable();

            var mockMessages = new Mock<DbSet<Message>>();
            mockMessages.As<IQueryable<Message>>().Setup(m => m.Provider).Returns(list1.Provider);
            mockMessages.As<IQueryable<Message>>().Setup(m => m.Expression).Returns(list1.Expression);
            mockMessages.As<IQueryable<Message>>().Setup(m => m.ElementType).Returns(list1.ElementType);
            mockMessages.As<IQueryable<Message>>().Setup(m => m.GetEnumerator()).Returns(list1.GetEnumerator());

            var mockContext = new Mock<AppDbContext>();
            mockContext.Setup(c => c.Messages).Returns(mockMessages.Object);

            _dbContext = mockContext.Object;
        }
コード例 #14
0
ファイル: UnitTest1.cs プロジェクト: SomeHero/SocialPayments
        public void WhenANewUserRegistersElasticEmailIsSent()
        {
            _ctx = new FakeDbContext();
            _processor = new UserProcessors.SubmittedUserProcessor(_ctx);

            var application = _ctx.Applications.Add(new Domain.Application() {
                ApiKey = Guid.NewGuid(),
                ApplicationName = "test",
                IsActive = true,
                Url = "http://www.paidthx.com"
            });

            var user = _ctx.Users.Add(new Domain.User()
            {
                ApiKey  = application.ApiKey,
                ConfirmationToken = "1234",
                CreateDate = System.DateTime.Now,
                EmailAddress = "*****@*****.**",
                IsConfirmed = false,
                MobileNumber = "804-387-9693",
                IsLockedOut = false,
                Limit = 100,
                SecurityPin = "1234",
                UserId = Guid.NewGuid(),
                UserName = "******",
                UserStatus = Domain.UserStatus.Submitted
            });

            _processor.Process(user);
        }
コード例 #15
0
ファイル: MeetingDtb.cs プロジェクト: phamquang1201/VPQH
 public MeetingDtb(IDbContext context, UserBus userBus, MeetingBus meetingBus, AttachmentBus attachmentBus)
     : base(context)
 {
     _userBus = userBus;
     _meetingBus = meetingBus;
     _attachmentBus = attachmentBus;
 }
コード例 #16
0
ファイル: ServiceBase.cs プロジェクト: phamquang1201/VPQH
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         Context = null;
     }
 }
コード例 #17
0
ファイル: PlatformDb.cs プロジェクト: carbon/Platform
        public PlatformDb(IDbContext context)
        {
            #region Preconditions

            if (context == null)
                throw new ArgumentNullException(nameof(context));

            #endregion

            this.context = context;
            
            Apps              = new Dataset<App>(context);
            AppInstances      = new Dataset<AppInstance>(context);
            AppReleases       = new Dataset<AppRelease>(context);
            AppEvents         = new Dataset<AppEvent>(context);
            AppErrors         = new Dataset<AppError>(context);

            // Frontends
            Frontends         = new Dataset<Frontend>(context);
            FrontendBranches  = new Dataset<FrontendBranch>(context);
            FrontendReleases  = new Dataset<FrontendRelease>(context);

            // Networks
            Networks          = new Dataset<Network>(context);
            NetworkInterfaces = new Dataset<NetworkInterfaceInfo>(context);

            Hosts             = new Dataset<Host>(context);
            Volumes           = new Dataset<VolumeInfo>(context);
            Images            = new Dataset<Image>(context);
        }
コード例 #18
0
ファイル: SportService.cs プロジェクト: raminmjj/SportsSystem
 public SportService(IDbContext dbContext)
 {
     _dbContext = dbContext;
     _sports = dbContext.Set<Sport>();
     _sportCategories = dbContext.Set<SportCategory>();
     _sportDetails = dbContext.Set<SportDetail>();
 }
コード例 #19
0
 public AdminController(IDbContext dbContext, IRepresentativeUserService representativeUserService, ICompetitionService competitionService, ICompetitionRepresentativeUserService competitionRepresentativeUserService)
 {
     _dbContext = dbContext;
     _representativeUserService = representativeUserService;
     _competitionService = competitionService;
     _competitionRepresentativeUserService = competitionRepresentativeUserService;
 }
コード例 #20
0
ファイル: CakeRepository.cs プロジェクト: mkeeton/Projects
        public CakeRepository(IDbContext context)
        {
            if (context == null)
            throw new ArgumentNullException("connectionString");

              this.CurrentContext = context;
        }
コード例 #21
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="logRepository">Log repository</param>
 /// <param name="webHelper">Web helper</param>>
 /// <param name="dbContext">DB context</param>>
 /// <param name="dataProvider">WeData provider</param>
 /// <param name="commonSettings">Common settings</param>
 public DefaultLogger(IRepository<Log> logRepository, IWebHelper webHelper, IDbContext dbContext, IDataProvider dataProvider)
 {
     this._logRepository = logRepository;
     this._webHelper = webHelper;
     this._dbContext = dbContext;
     this._dataProvider = dataProvider;
 }
コード例 #22
0
 internal static void Start(MQConnectionPool mqpool)
 {
     _mqpool = mqpool;
     _dbContext = new DbContext().ConnectionString(Config.DBConnectString, new MySqlProvider());
     StartSignWatcher();
     StartSubmiterWatcher();
 }
コード例 #23
0
 public void MyTestInitialize()
 {
     this._db = new R2DisasterContext();
     this._re = new EFRepository<Comprehensive>(this._db);
     this._reGBCode = new EFRepository<GBCode>(this._db);
     this._service = new ComprehensiveService(this._re);
 }
コード例 #24
0
 public CustomerService(IDbContext context, IRepository<Customer> customerRepository, IRepository<CustomerRole> customerRoleRepository, IRepository<ContactU> contactUsRepository)
 {
     this._context = context;
     this._customerRepository = customerRepository;
      this._customerRoleRepository=customerRoleRepository;
      this._contactUsRepository = contactUsRepository;
 }
コード例 #25
0
		public DbContextScope(IDbContext ctx = null, 
			bool? autoDetectChanges = null, 
			bool? proxyCreation = null, 
			bool? validateOnSave = null, 
			bool? forceNoTracking = null,
			bool? hooksEnabled = null)
        {
			_ctx = ctx ?? EngineContext.Current.Resolve<IDbContext>();
			_autoDetectChangesEnabled = _ctx.AutoDetectChangesEnabled;
			_proxyCreationEnabled = _ctx.ProxyCreationEnabled;
			_validateOnSaveEnabled = _ctx.ValidateOnSaveEnabled;
			_forceNoTracking = _ctx.ForceNoTracking;
			_hooksEnabled = _ctx.HooksEnabled;
            
            if (autoDetectChanges.HasValue)
				_ctx.AutoDetectChangesEnabled = autoDetectChanges.Value;

            if (proxyCreation.HasValue)
				_ctx.ProxyCreationEnabled = proxyCreation.Value;

            if (validateOnSave.HasValue)
				_ctx.ValidateOnSaveEnabled = validateOnSave.Value;

			if (forceNoTracking.HasValue)
				_ctx.ForceNoTracking = forceNoTracking.Value;

			if (hooksEnabled.HasValue)
				_ctx.HooksEnabled = hooksEnabled.Value;
        }
コード例 #26
0
        public AUSaleService(
            IRepository<AULotRecord> lotRepo,
            IConsignorService consignorService,
            IAuthenticationService authenticationService,
            IRepository<AUConsignmentLotRecord> consignmentlotRepo,
            IRepository<AUCountryLotRecord> countrylotRepo,
            IRepository<AUStateProvinceLotRecord> stateprovincelotRepo,
            IRepository<AULotLotRecord> lotlotRepo,
            IRepository<AUSaleRecord> saleRepo,
            IProductService productService,
            IDataProvider dataProvider,
            IDbContext dbContext,
            ICategoryService categoryService

            )
        {
            this._lotRepo = lotRepo;
            this._consignorService = consignorService;
            this._authenticationService = authenticationService;
            this._consignmentlotRepo = consignmentlotRepo;
            this._countrylotRepo = countrylotRepo;
            this._stateprovincelotRepo = stateprovincelotRepo;
            this._lotlotRepo = lotlotRepo;
            this._saleRepo = saleRepo;
            this._productService = productService;
            this._dataProvider = dataProvider;
            this._dbContext = dbContext;
            this._categoryService = categoryService;
        }
コード例 #27
0
ファイル: UnitOfWork.cs プロジェクト: mkeeton/Projects
        public UnitOfWork(IDbContext context)
        {
            if (context == null)
            throw new ArgumentNullException("connectionString");

              this._dbContext = context;
        }
コード例 #28
0
        public SearchCategorySelectionRepository(IDbContext context)
        {
            if (context == null)
            throw new ArgumentNullException("connectionString");

              this.CurrentContext = context;
        }
コード例 #29
0
        public BaseController(IDbContext context) {
            if (context == null) {
                throw new ArgumentNullException("dbContext");
            }

            this.context = context;
        }
コード例 #30
0
 public AccountController(IDbContext dbContext, IRepresentativeUserService representativeUserService, IFormsAuthenticationService formsAuthentication, IUserService userService)
 {
     _dbContext = dbContext;
     _representativeUserService = representativeUserService;
     _formsAuthentication = formsAuthentication;
     _userService = userService;
 }
コード例 #31
0
 /// <summary>
 /// dbContext.Update&lt;TEntity&gt;(a => a.PrimaryKey == key, a => new TEntity() { IsDeleted = true, DeletionTime = DateTime.Now, DeleteUserId = deleteUserId });
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="dbContext"></param>
 /// <param name="key"></param>
 /// <param name="deleteUserId"></param>
 /// <returns></returns>
 public static int SoftDelete <TEntity>(this IDbContext dbContext, object key, object deleteUserId)
 {
     return(dbContext.SoftDelete <TEntity>(key, DateTime.Now, deleteUserId));
 }
コード例 #32
0
 public Repository(IDbContext objectContext)
 {
     _objectContext = objectContext;
     _objectSet     = _objectContext.CreateObjectSet <T>();
 }
コード例 #33
0
 public SocialNetworkRepository(IDbContext context) : base(context)
 {
     _socialnetworkRepository = Context.GetRepository <SocialNetwork>();
 }
コード例 #34
0
 public AttridaCommentDbDataSource(IDbContext dbContext, ISoftDeleteManager softDeleteManager)
     : base(dbContext, softDeleteManager)
 {
 }
コード例 #35
0
 public CheckOrderResultMiddleware(IDbContext dbContext, ICurrentUserService currentUserService)
 {
     _dbContext          = dbContext;
     _currentUserService = currentUserService;
 }
コード例 #36
0
 public GameRepository(IDbContext context) : base(context)
 {
 }
コード例 #37
0
 public EOJiaDongRateContrastService(IDbContext context) : base(context)
 {
 }
コード例 #38
0
        /// <summary>
        /// 传入一个 dto 对象更新数据。dto 需要与实体建立映射关系,否则会报错
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="dbContext"></param>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static int UpdateFromDto <TEntity, TDto>(this IDbContext dbContext, TDto dto)
        {
            /*
             * 动态构造 lambda 更新数据:
             * dbContext.Update<TEntity>(a => a.Id = dto.Id, a => new TEntity(){ Name = dto.Name, Age = dto.Age... });
             * 支持自动设置更新时间 UpdationTime=DateTime.Now
             */

            Utils.CheckNull(dto);

            Type           entityType     = typeof(TEntity);
            TypeDescriptor typeDescriptor = TypeDescriptor.GetDescriptor(entityType);

            if (typeDescriptor.PrimaryKeys.Count != 1)
            {
                throw new NotSupportedException("仅支持只有一个主键的实体");
            }

            TypeMap typeMap = GetTypeMap <TDto, TEntity>();

            PropertyMap[] propertyMaps = typeMap.GetPropertyMaps();

            object key = null;
            List <MemberBinding> bindings = new List <MemberBinding>();

            ConstantExpression dtoConstantExp = Expression.Constant(dto);

            foreach (PropertyMap propertyMap in propertyMaps)
            {
                var mappingMemberDescriptor = typeDescriptor.TryGetMappingMemberDescriptor(propertyMap.DestinationProperty);

                if (mappingMemberDescriptor == null)
                {
                    continue;
                }

                /* 跳过主键和自增列 */
                if (mappingMemberDescriptor.IsPrimaryKey)
                {
                    key = propertyMap.SourceMember.GetMemberValue(dto);
                    continue;
                }
                if (mappingMemberDescriptor.IsAutoIncrement)
                {
                    continue;
                }

                MemberAssignment bind = null;
                if (propertyMap.DestinationProperty.Name == "UpdationTime")
                {
                    object updationTime = propertyMap.SourceMember.GetMemberValue(dto);
                    if (updationTime.IsDefaultValueOfType(propertyMap.SourceMember.GetMemberType())) /* 表示未设置更新时间,此时我们使用 DateTime.Now */
                    {
                        var updationTimeExp = Chloe.Extensions.ExpressionExtension.MakeWrapperAccess(DateTime.Now, propertyMap.DestinationProperty.GetMemberType());
                        bind = Expression.Bind(propertyMap.DestinationProperty, updationTimeExp);
                    }
                }

                if (bind == null)
                {
                    Expression dtoMemberAccess = Expression.MakeMemberAccess(dtoConstantExp, propertyMap.SourceMember);
                    if (propertyMap.DestinationProperty.GetMemberType() != propertyMap.SourceMember.GetMemberType())
                    {
                        dtoMemberAccess = Expression.Convert(dtoMemberAccess, propertyMap.DestinationProperty.GetMemberType());
                    }
                    bind = Expression.Bind(propertyMap.DestinationProperty, dtoMemberAccess);
                }

                bindings.Add(bind);
            }

            if (key == null)
            {
                throw new ArgumentException("未能从 dto 中找到主键或主键为空");
            }

            return(dbContext.Update <TEntity>(key, bindings));
        }
コード例 #39
0
 /// <summary>
 /// 初始化类<see cref="ObjectManagerBase{TModel, TKey}"/>。
 /// </summary>
 /// <param name="context">数据库操作实例。</param>
 protected ObjectManagerBase(IDbContext <TModel> context) : base(context)
 {
 }
コード例 #40
0
 /// <summary>
 /// dbContext.Update&lt;TEntity&gt;(a => a.PrimaryKey == key, a => new TEntity() { IsEnabled = true });
 /// </summary>
 /// <typeparam name="TEntity">必须包含 IsEnabled 属性</typeparam>
 /// <param name="dbContext"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public static int Enable <TEntity>(this IDbContext dbContext, object key)
 {
     return(UpdateIsEnabled <TEntity>(dbContext, key, true));
 }
コード例 #41
0
 public Detalle_PlatillosService(IDataProvider dataProvider, IDbContext dbContext, IRepository <Spartane.Core.Classes.Detalle_Platillos.Detalle_Platillos> Detalle_PlatillosRepository)
 {
     this._dataProvider = dataProvider;
     this._dbContext    = dbContext;
     this._Detalle_PlatillosRepository = Detalle_PlatillosRepository;
 }
コード例 #42
0
 public UnitOfWork(string connectionString, IDbContext dbContext)
 {
     _dbContext        = dbContext;
     _connectionString = connectionString;
 }
コード例 #43
0
 public DocumentRepository(IDbContext ctx)
 {
     this.ctx = ctx;
 }
コード例 #44
0
 /// <summary>
 /// 仓储类的构造函数
 /// </summary>
 /// <param name="dbContext">数据库上下文</param>
 public WHStorageTypeReposity(IDbContext dbContext)
     : base(dbContext)
 {
 }
コード例 #45
0
 public GenericRepository(IDbContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
コード例 #46
0
 public UnitOfWork(IDbContext context)
 {
     _dbContext = context;
 }
コード例 #47
0
 /// <summary>
 /// 借用单查询类的构造函数
 /// </summary>
 /// <param name="dbContext">数据库上下文</param>
 public AssBorrowOrderRepository(IDbContext dbContext)
     : base(dbContext)
 {
 }
コード例 #48
0
 public ProjectRepository(IDbContext dbContext)
     : base(dbContext)
 {
 }
コード例 #49
0
 public UnitOfWork(IServiceLocator serviceLocator)
 {
     this.context = serviceLocator.Resolve <IDbContext>("SchoolDB");
 }
コード例 #50
0
 public CRMLeadSourceRepository(IDbContext context) : base(context)
 {
 }
コード例 #51
0
 public Agente_del_Ministerio_PublicoService(IDataProvider dataProvider, IDbContext dbContext, IRepository <Spartane.Core.Domain.Agente_del_Ministerio_Publico.Agente_del_Ministerio_Publico> Agente_del_Ministerio_PublicoRepository)
 {
     this._dataProvider = dataProvider;
     this._dbContext    = dbContext;
     this._Agente_del_Ministerio_PublicoRepository = Agente_del_Ministerio_PublicoRepository;
 }
コード例 #52
0
 public DbContextQueryHandler(IDbContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #53
0
 public DepositAccountHandler(IDbContext context)
 {
     _context = context;
 }
コード例 #54
0
 public ActivityInstanceRepository(IDbContext dbContext) : base(dbContext)
 {
 }
コード例 #55
0
 public TransactionalCommandHandler(IRequestHandler <IRequest <TResponse>, TResponse> requestHandler, IDbContext dbContext, ILogger <TransactionalCommandHandler <TCommand, TResponse> > logger)
 {
     _requestHandler = requestHandler;
     _dbContext      = dbContext;
     _logger         = logger;
 }
コード例 #56
0
 public NoteUserRepository(IDbContext context) : base(context)
 {
 }
コード例 #57
0
 public DataAccess(IDbContext context)
 {
     _dbContext = context;
 }
コード例 #58
0
 public EfRepository(IDbContext context) => _context = context;
コード例 #59
0
 public NoteStyleRepository(IDbContext context) : base(context)
 {
 }
コード例 #60
0
 public CountriesController(IDbContext db)
 {
     _db = db;
 }