public AccountService(AccountRepository repository, ResourceService resourceService, ActiveDirectoryService activeDirectoryService, IBoundedContext bounded) { this.repository = repository; this.resourceService = resourceService; this.activeDirectoryService = activeDirectoryService; Bounded = bounded; }
/// <summary> /// Initialize a new instance of the AzureTopicEventBusReader /// </summary> /// <param name="sbsConnectionString">Service Bus Connection String</param> /// <param name="topicName">Topic Name</param> /// <param name="subscriptionName">Subscription Name</param> /// <param name="context">Bounded context</param> /// <param name="typeResolver">Type resolver for mapping JSON back to contract objects</param> /// <param name="dispatcher">Event Dispatcher for finding handlers for events after processing</param> public AzureTopicEventBusReader(string sbsConnectionString, string topicName, string subscriptionName, IBoundedContext context, ITypeResolver typeResolver, IDispatcher<IEvent> dispatcher) : base(context, typeResolver, dispatcher) { // Build instance CurrentSubscription = SubscriptionClient.CreateFromConnectionString(sbsConnectionString, topicName, subscriptionName); }
/// <summary> /// 保存应用信息 /// </summary> /// <param name="dbContext">上下文对象</param> /// <param name="dto">应用信息</param> /// <returns>是否成功</returns> protected virtual bool SaveApp(IBoundedContext dbContext, SYSAppRegistDTO dto) { if (!(dto.App.ID > 0)) { InitApp(dto.App); } return(dto.App.ID.HasValue ? dbContext.Modify(dto.App) : dbContext.Add(dto.App)); }
/// <summary> /// Initialize a new RabbitMqEventBusReader /// </summary> /// <param name="connectionSettings">Subscription Settings</param> /// <param name="context">Bounded context</param> /// <param name="resolver">Type resolver</param> /// <param name="dispatcher">Event dispatcher</param> public RabbitMqEventBusReader(RabbitMqSubscribeSettings connectionSettings, IBoundedContext context, ITypeResolver resolver, IDispatcher<IEvent> dispatcher) : base(context, resolver, dispatcher) { // Validate inputs if (connectionSettings == null) throw new ArgumentNullException(nameof(connectionSettings)); // Build instance ConnectionSettings = connectionSettings; }
protected virtual void SaveFile(IBoundedContext dbContext, SYSAttach info) { if (info.Mode == (int)ModeEnum.数据库存储 && info.FileStream != null) { info.DependOn(dbContext); info.WriteFile(info.FileStream, info.ID.Value); info.FileStream.Close(); info.FileStream.Dispose(); info.FileStream = null; } }
/// <summary> /// Initialize a new instance of the EventBusReaderBase /// </summary> /// <param name="context">Bounded context</param> /// <param name="typeResolver">Type resolver for mapping JSON back to contract objects</param> /// <param name="dispatcher">Event Dispatcher for finding handlers for events after processing</param> protected EventBusReaderBase(IBoundedContext context, ITypeResolver typeResolver, IDispatcher<IEvent> dispatcher) { // Validate Arguments if (context == null) throw new ArgumentNullException(nameof(context)); if (typeResolver == null) throw new ArgumentNullException(nameof(typeResolver)); if (dispatcher == null) throw new ArgumentNullException(nameof(dispatcher)); // Build instance BoundedContext = context; Dispatcher = dispatcher; TypeResolver = typeResolver; }
/// <summary> /// 保存应用用户组关联信息 /// </summary> /// <param name="dbContext">上下文对象</param> /// <param name="dto">应用信息</param> /// <returns>是否成功</returns> protected virtual bool SaveAppAccess(IBoundedContext dbContext, SYSAppRegistDTO dto) { var result = true; var appAccess = dbContext.Repository <SYSAppAccess>(); if (dto.App.ID > 0) { appAccess.Remove(new Spec <SYSAppAccess>(d => d.AppID == dto.App.ID)); } if (dto.AppGroups != null) { foreach (var appAccessInfo in dto.AppGroups) { appAccessInfo.AppID = dto.App.ID; if (!(result = appAccess.Add(appAccessInfo))) { break; } } } return(result); }
/// <summary> /// 保存应用菜单信息 /// </summary> /// <param name="dbContext">上下文对象</param> /// <param name="dto">应用信息</param> /// <returns>是否成功</returns> protected virtual bool SaveMenu(IBoundedContext dbContext, SYSAppRegistDTO dto) { var menu = dbContext.Repository <SYSMenu>(); var q = from d in menu.Entities where d.AppID == dto.App.ID && d.Layer == 0 select d; var target = q.FirstOrDefault(); if (target != null) { dto.Menu.Map(target); } else { target = dto.Menu; } InitMenu(dto.App, target); return(target.ID > 0 ? menu.Modify(target) : menu.Add(target)); }
/// <summary> /// Initializes a new instance of <see cref="Module"/> /// </summary> /// <param name="boundedContext"><see cref="IBoundedContext"/> the <see cref="Module"/> belongs to</param> /// <param name="moduleName"><see cref="ModuleName">Name</see> of the business component</param> public Module(IBoundedContext boundedContext, ModuleName moduleName) { Parent = boundedContext; Name = moduleName; boundedContext.AddModule(this); }
/// <summary> /// Initialize a new instance of the AzureEventBusWriter /// </summary> /// <param name="context">Bounded Context</param> /// <param name="sbsConnectionString">Service Bus Connection String</param> /// <param name="topicName">Topic Name</param> public AzureTopicEventBusWriter(IBoundedContext context, string sbsConnectionString, string topicName) { Context = context; TopicWriter = TopicClient.CreateFromConnectionString(sbsConnectionString, topicName); }
public FileStorageServie(IBoundedContext boundedContext) { rootPath = Path.Combine(boundedContext.ContentRootPath, "FileStorage"); this.boundedContext = boundedContext; }
public ProjectMasterService(ProjectRepository repository, ISerialNumberProvider serialNumberProvider, FileStorageServie fileStorageServie, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; this.serialNumberProvider = serialNumberProvider; this.fileStorageServie = fileStorageServie; }
public StandingbookService(ProjectRepository repository, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; }
public ResourceService(System.IServiceProvider serviceProvider, IBoundedContext bounded) { this.serviceProvider = serviceProvider; Init().GetAwaiter(); }
/// <summary> /// Initializes a new instance of <see cref="FeatureAlreadyAddedToModule"/> /// </summary> /// <param name="boundedContext"><see cref="IBoundedContext">Bounded context</see> the feature is already added to</param> /// <param name="module"><see cref="IModule">Module</see> hat is already added</param> public ModuleAlreadyAddedToBoundedContext(IBoundedContext boundedContext, IModule module) : base($"Module '{module.Name}' has already been added to the bounded context '{boundedContext.Name}'") { }
public SettingService(SettingRepository repository, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; }
public CalculationService(ProjectRepository repository, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; }
public SupplierService(IRepository <Supplier> repository, ResourceService resourceService, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; this.resourceService = resourceService; }
public BaseService(IBoundedContext bounded, IStaffeUser user) { this.Bounded = bounded; this.User = user; }
public object GetId([FromServices] IBoundedContext service, [FromQuery] ProjectQueryRequest queryRequest) { return(service.Generator.New()); }
public BasicDataService(IRepository <BasicData> repository, ResourceService resourceService, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; this.resourceService = resourceService; }
public ProjectProcurementService(ProjectRepository repository, FileStorageServie fileStorageServie, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; this.fileStorageServie = fileStorageServie; }
public override void DependOn(IBoundedContext uow) { base.DependOn(uow); Instance.DependOn(uow); }
/// <summary> /// Registers a bounded context /// </summary> /// <param name="boundedContext">An instance of a class implementing <see cref="IBoundedContext"/></param> public void Register(IBoundedContext boundedContext) { this.ThrowExceptionIfAlreadyStarted(); this.boundedContexts.Add(boundedContext); }
/// <summary> /// 将工作单元注入到实现了ITransientDependency接口的私有属性 /// </summary> /// <param name="uow"></param> public virtual void DependOn(IBoundedContext uow) { this.Context = uow; CFConfig.Default.ScanField <ITransientDependency>(this.GetType(), field => (field.GetValue(this) as ITransientDependency).DependOn(uow)); }
public TargetCostService(TargetCostRepository repository, ISerialNumberProvider serialNumberProvider, IBoundedContext bounded, IStaffeUser user) : base(bounded, user) { this.repository = repository; this.serialNumberProvider = serialNumberProvider; }