public EmailService(IDbContext context, Logger logger) { _ctx = context; _logger = logger; _applicationService = new ApplicationService(_ctx); _emailLogService = new EmailLogService(_ctx); }
public AnswersController(IDbContext dataContext) { if (dataContext != null) { this.dataContext = dataContext; } }
public UserService(IDbContext dbContext, IRepository<User> repository, IRepository<UserRole> roleRepository) { this.dbContext = dbContext; this.repository = repository; this.roleRepository = roleRepository; }
public EmailService(IDbContext context, Logger logger, ApplicationService applicationService, EmailLogService emailLogService) { _ctx = context; _logger = logger; _applicationService = applicationService; _emailLogService = emailLogService; }
public ScoresController(IDbContext context, ICompiler compiler, IRunner runner, Participant participant = null) { _context = context; _compiler = compiler; _runner = runner; _participant = participant ?? GetCurrentParticipant(); }
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); }
/// <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; }
public MsgRecordService(IRepository<MsgRecord> _msgRecordRepository, IRepository<ContactGroupSub> _contactGroupSubRepository , IDbContext _context) { msgRecordRepository = _msgRecordRepository; context = _context; contactGroupSubRepository = _contactGroupSubRepository; }
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; }); }
public DefaultLogger(IRepository<Log> logRepository, IWebHelper webHelper, IDbContext dbContext, IWorkContext workContext) { this._logRepository = logRepository; this._webHelper = webHelper; this._dbContext = dbContext; this._workContext = workContext; }
public UserPanelController(IDbContext dbContext, ITechnicalStaffService technicalStaffService, IParticipationService participationService, ITechnicalStaffRoleService technicalStaffRoleService) { _dbContext = dbContext; _technicalStaffService = technicalStaffService; _participationService = participationService; _technicalStaffRoleService = technicalStaffRoleService; }
public RunController(IDbContext context, ICompiler compiler, IRunner runner, Participant participant = null) { _context = context; _compiler = compiler; _runner = runner; _participant = participant == null ? GetCurrentParticipant() : participant; }
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; }
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); }
public MeetingDtb(IDbContext context, UserBus userBus, MeetingBus meetingBus, AttachmentBus attachmentBus) : base(context) { _userBus = userBus; _meetingBus = meetingBus; _attachmentBus = attachmentBus; }
protected virtual void Dispose(bool disposing) { if (disposing) { Context = null; } }
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); }
public SportService(IDbContext dbContext) { _dbContext = dbContext; _sports = dbContext.Set<Sport>(); _sportCategories = dbContext.Set<SportCategory>(); _sportDetails = dbContext.Set<SportDetail>(); }
public AdminController(IDbContext dbContext, IRepresentativeUserService representativeUserService, ICompetitionService competitionService, ICompetitionRepresentativeUserService competitionRepresentativeUserService) { _dbContext = dbContext; _representativeUserService = representativeUserService; _competitionService = competitionService; _competitionRepresentativeUserService = competitionRepresentativeUserService; }
public CakeRepository(IDbContext context) { if (context == null) throw new ArgumentNullException("connectionString"); this.CurrentContext = context; }
/// <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; }
internal static void Start(MQConnectionPool mqpool) { _mqpool = mqpool; _dbContext = new DbContext().ConnectionString(Config.DBConnectString, new MySqlProvider()); StartSignWatcher(); StartSubmiterWatcher(); }
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); }
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; }
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; }
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; }
public UnitOfWork(IDbContext context) { if (context == null) throw new ArgumentNullException("connectionString"); this._dbContext = context; }
public SearchCategorySelectionRepository(IDbContext context) { if (context == null) throw new ArgumentNullException("connectionString"); this.CurrentContext = context; }
public BaseController(IDbContext context) { if (context == null) { throw new ArgumentNullException("dbContext"); } this.context = context; }
public AccountController(IDbContext dbContext, IRepresentativeUserService representativeUserService, IFormsAuthenticationService formsAuthentication, IUserService userService) { _dbContext = dbContext; _representativeUserService = representativeUserService; _formsAuthentication = formsAuthentication; _userService = userService; }
/// <summary> /// dbContext.Update<TEntity>(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)); }
public Repository(IDbContext objectContext) { _objectContext = objectContext; _objectSet = _objectContext.CreateObjectSet <T>(); }
public SocialNetworkRepository(IDbContext context) : base(context) { _socialnetworkRepository = Context.GetRepository <SocialNetwork>(); }
public AttridaCommentDbDataSource(IDbContext dbContext, ISoftDeleteManager softDeleteManager) : base(dbContext, softDeleteManager) { }
public CheckOrderResultMiddleware(IDbContext dbContext, ICurrentUserService currentUserService) { _dbContext = dbContext; _currentUserService = currentUserService; }
public GameRepository(IDbContext context) : base(context) { }
public EOJiaDongRateContrastService(IDbContext context) : base(context) { }
/// <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)); }
/// <summary> /// 初始化类<see cref="ObjectManagerBase{TModel, TKey}"/>。 /// </summary> /// <param name="context">数据库操作实例。</param> protected ObjectManagerBase(IDbContext <TModel> context) : base(context) { }
/// <summary> /// dbContext.Update<TEntity>(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)); }
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; }
public UnitOfWork(string connectionString, IDbContext dbContext) { _dbContext = dbContext; _connectionString = connectionString; }
public DocumentRepository(IDbContext ctx) { this.ctx = ctx; }
/// <summary> /// 仓储类的构造函数 /// </summary> /// <param name="dbContext">数据库上下文</param> public WHStorageTypeReposity(IDbContext dbContext) : base(dbContext) { }
public GenericRepository(IDbContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public UnitOfWork(IDbContext context) { _dbContext = context; }
/// <summary> /// 借用单查询类的构造函数 /// </summary> /// <param name="dbContext">数据库上下文</param> public AssBorrowOrderRepository(IDbContext dbContext) : base(dbContext) { }
public ProjectRepository(IDbContext dbContext) : base(dbContext) { }
public UnitOfWork(IServiceLocator serviceLocator) { this.context = serviceLocator.Resolve <IDbContext>("SchoolDB"); }
public CRMLeadSourceRepository(IDbContext context) : base(context) { }
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; }
public DbContextQueryHandler(IDbContext dbContext) { _dbContext = dbContext; }
public DepositAccountHandler(IDbContext context) { _context = context; }
public ActivityInstanceRepository(IDbContext dbContext) : base(dbContext) { }
public TransactionalCommandHandler(IRequestHandler <IRequest <TResponse>, TResponse> requestHandler, IDbContext dbContext, ILogger <TransactionalCommandHandler <TCommand, TResponse> > logger) { _requestHandler = requestHandler; _dbContext = dbContext; _logger = logger; }
public NoteUserRepository(IDbContext context) : base(context) { }
public DataAccess(IDbContext context) { _dbContext = context; }
public EfRepository(IDbContext context) => _context = context;
public NoteStyleRepository(IDbContext context) : base(context) { }
public CountriesController(IDbContext db) { _db = db; }