Exemplo n.º 1
0
 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);
 }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 7
0
        /// <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);
        }
Exemplo n.º 8
0
        /// <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));
        }
Exemplo n.º 9
0
 /// <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);
 }
Exemplo n.º 11
0
 public FileStorageServie(IBoundedContext boundedContext)
 {
     rootPath            = Path.Combine(boundedContext.ContentRootPath, "FileStorage");
     this.boundedContext = boundedContext;
 }
Exemplo n.º 12
0
 public ProjectMasterService(ProjectRepository repository, ISerialNumberProvider serialNumberProvider, FileStorageServie fileStorageServie, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository           = repository;
     this.serialNumberProvider = serialNumberProvider;
     this.fileStorageServie    = fileStorageServie;
 }
Exemplo n.º 13
0
 public StandingbookService(ProjectRepository repository, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository = repository;
 }
Exemplo n.º 14
0
 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}'")
 {
 }
Exemplo n.º 16
0
 public SettingService(SettingRepository repository, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository = repository;
 }
Exemplo n.º 17
0
 public CalculationService(ProjectRepository repository, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository = repository;
 }
Exemplo n.º 18
0
 public SupplierService(IRepository <Supplier> repository, ResourceService resourceService, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository      = repository;
     this.resourceService = resourceService;
 }
Exemplo n.º 19
0
 public BaseService(IBoundedContext bounded, IStaffeUser user)
 {
     this.Bounded = bounded;
     this.User    = user;
 }
Exemplo n.º 20
0
 public object GetId([FromServices] IBoundedContext service, [FromQuery] ProjectQueryRequest queryRequest)
 {
     return(service.Generator.New());
 }
Exemplo n.º 21
0
 public BasicDataService(IRepository <BasicData> repository, ResourceService resourceService, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository      = repository;
     this.resourceService = resourceService;
 }
Exemplo n.º 22
0
 public ProjectProcurementService(ProjectRepository repository, FileStorageServie fileStorageServie, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository        = repository;
     this.fileStorageServie = fileStorageServie;
 }
Exemplo n.º 23
0
 public override void DependOn(IBoundedContext uow)
 {
     base.DependOn(uow);
     Instance.DependOn(uow);
 }
Exemplo n.º 24
0
 /// <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);
 }
Exemplo n.º 25
0
 /// <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));
 }
Exemplo n.º 26
0
 public TargetCostService(TargetCostRepository repository, ISerialNumberProvider serialNumberProvider, IBoundedContext bounded, IStaffeUser user) : base(bounded, user)
 {
     this.repository           = repository;
     this.serialNumberProvider = serialNumberProvider;
 }