Esempio n. 1
0
        private static Func <Version, Tuple <Type, IMessagePipe> > BuildMessagePipeSelector(IComponentContext context)
        {
            Func <Version, Tuple <Type, IMessagePipe> > result =
                version =>
            {
                var allPipesLazy = context.Resolve <IEnumerable <Meta <IMessagePipe> > >();

                Type         selectedType = null;
                IMessagePipe selectedPipe = null;
                foreach (var pipe in allPipesLazy)
                {
                    var storedVersion = pipe.Metadata["Version"] as Version;
                    var storedType    = pipe.Metadata["RegisteredType"] as Type;
                    if (storedVersion.Equals(version))
                    {
                        selectedPipe = pipe.Value;
                        selectedType = storedType;
                    }
                }

                return(new Tuple <Type, IMessagePipe>(selectedType, selectedPipe));
            };

            return(result);
        }
Esempio n. 2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    //if (clip != null)
                    //{
                    //    clip.Dispose();
                    //}
                    DrawingPen.Dispose();
                    DrawingBrush.Dispose();
                    style.BorderPattern.PropertyChanged -= BorderPattern_PropertyChanged;
                }


                mp      = null;
                style   = null;
                Drawing = null;
                //Preparing = null;


                disposedValue = true;
            }
        }
        public SoftwareModelService(
            FsUnitOfWork db,
            FSSecurityContext securityContext,
            ReferenceProvider referenceService,
            BusinessUnitProvider businessUnitService,
            CapabilityProvider capabilityProvider,
            ProjectService projectService,
            StakeholderService stakeholderService,
            SoftwareModelInterfaceService softwareModelInterfaceService,
            ProviderLinq <SoftwareModelDependency, Guid> softwareModelDependencyProvider,
            IEntityIdProvider <SoftwareModel, Guid> idProvider,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <SoftwareModel> specProvider = null,
            EntityHandler <SoftwareModel, Guid> entityHandler   = null)
            : base(securityContext, referenceService, db, idProvider, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(securityContext, nameof(securityContext));
            Guard.ArgumentNotNull(capabilityProvider, nameof(capabilityProvider));
            Guard.ArgumentNotNull(referenceService, nameof(referenceService));
            Guard.ArgumentNotNull(softwareModelInterfaceService, nameof(softwareModelInterfaceService));

            _sfDb = db;

            _capabilitiesProvider           = capabilityProvider;
            _businessUnitService            = businessUnitService;
            _stakeholderService             = stakeholderService;
            _softwareModelInterfaceService  = softwareModelInterfaceService;
            _softwareModelDependencyService = softwareModelDependencyProvider;
            _projectService = projectService;
        }
 public LifeCycleProvider(
     IUnitOfWorkLinq <LifeCycle, string> db,
     IEntityIdProvider <LifeCycle, string> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <LifeCycle> specProvider  = null,
     EntityHandler <LifeCycle, string> onBeforeInsert = null)
     : base(db, keyBinder, messagePipe, specProvider, onBeforeInsert)
 {
 }
 /// <summary>
 ///     Creates a new instance.
 /// </summary>
 public ScenarioProvider(
     IUnitOfWorkLinq <Scenario, Guid> db,
     IEntityIdProvider <Scenario, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <Scenario> specProvider = null,
     EntityHandler <Scenario, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
Esempio n. 6
0
 public StakeholderLoginProvider(
     IUnitOfWorkLinq <StakeholderLogin, Guid> db,
     IEntityIdProvider <StakeholderLogin, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <StakeholderLogin> specProvider = null,
     EntityHandler <StakeholderLogin, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
 /// <summary>
 ///     Creates a new instance.
 /// </summary>
 public CapabilityProvider(
     IUnitOfWorkLinq <Capability, Guid> db,
     IEntityIdProvider <Capability, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <Capability> specProvider = null,
     EntityHandler <Capability, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
Esempio n. 8
0
 public BusinessUnitProvider(
     IUnitOfWorkLinq <BusinessUnit, Guid> db,
     IEntityIdProvider <BusinessUnit, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <BusinessUnit> specProvider = null,
     EntityHandler <BusinessUnit, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
Esempio n. 9
0
 public ProtocolTypeProvider(
     IUnitOfWorkLinq <ProtocolType, string> db,
     IEntityIdProvider <ProtocolType, string> idProvider,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <ProtocolType> specProvider = null,
     EntityHandler <ProtocolType, string> entityHandler = null) :
     base(db, idProvider, messagePipe, specProvider, entityHandler)
 {
 }
Esempio n. 10
0
 public PolicyProvider(
     IUnitOfWorkLinq <Policy, Guid> db,
     ReferenceProvider referencesProvider,
     IEntityIdProvider <Policy, Guid> idProvider,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <Policy> specProvider = null,
     EntityHandler <Policy, Guid> entityHandler   = null) :
     base(db, idProvider, messagePipe, specProvider, entityHandler)
 {
     _referencesProvider = referencesProvider;
     _db = db;
 }
Esempio n. 11
0
 public ApplicationAccessService(
     FsUnitOfWork db,
     DeviceService deviceService,
     IEntityIdProvider <ApplicationAccess, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <ApplicationAccess> specProvider = null,
     EntityHandler <ApplicationAccess, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
     _deviceService = deviceService;
     _db            = db;
 }
        /// <summary>
        ///     Creates a new instance.
        /// </summary>
        /// <param name="db">The references database.</param>
        /// <param name="keyBinder"></param>
        /// <param name="messagePipe"></param>
        /// <param name="referencesSpec">Rules to validate a given reference entity.</param>
        public ReferenceProvider(
            IUnitOfWorkLinq <Reference, Guid> db,
            IEntityIdProvider <Reference, Guid> keyBinder,
            IMessagePipe messagePipe,
            IProvideSpecifications <Reference> referencesSpec = null,
            EntityHandler <Reference, Guid> entityHandler     = null)
            : base(db, keyBinder, messagePipe, referencesSpec, entityHandler)
        {
            Guard.ArgumentNotNull(db, nameof(db));

            _db = db;
        }
Esempio n. 13
0
        /// <summary>
        ///     Creates a new generic service to add/update valid entities and/or remove them from the application.
        /// </summary>
        /// <param name="messagePipe">Message pipe to dispatch domain events.</param>
        /// <param name="db">The data store to use to persist the entity.</param>
        /// <param name="idProvider">Function to get a new key for a given entity.</param>
        /// <param name="specProvider">
        ///     The custom rule provider to use to validate entities added/updated to the service. By
        ///     default service will use data annotations to build business rules to validate the object.
        /// </param>
        /// <param name="handler">A handler to use to process entities being added/removed or activated through the provider.</param>
        public ProviderLinq(
            IUnitOfWorkLinq <TEntity, TKey> db,
            IKeyProvider <TEntity, TKey> idProvider,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <TEntity> specProvider = null,
            EntityHandler <TEntity, TKey> handler         = null)
        {
            Guard.ArgumentNotNull(db, nameof(db));
            Guard.ArgumentNotNull(messagePipe, nameof(messagePipe));

            Db = db;

            MessagePipe = messagePipe ?? new NoOpMessagePipe();
            _idProvider = idProvider;

            // wrap processors
            // ----------------------------------------------------
            _onBeforeDelete = new Stack <Action <TKey> >();
            _onBeforeInsert = new Stack <Action <TEntity> >();
            _onInitialize   = new Stack <Action <TEntity> >();

            if (handler != null)
            {
                if (handler.RemoveHandler != null)
                {
                    OnRemoving(handler.RemoveHandler.Handle);
                }

                if (handler.AddHandler != null)
                {
                    OnAdding(handler.AddHandler.Handle);
                }

                if (handler.ActivateHandler != null)
                {
                    OnInitializing(handler.ActivateHandler.Handle);
                }
            }
            // ---------------------------------------------------

            //assign specs
            // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
            if (specProvider != null)
            {
                _specs = specProvider.GetSpecifications().ToList();
            }
            else
            {
                _specs = _defaultSpecs;
            }
        }
 public DesignDomainService(
     FsUnitOfWork db,
     PolicyProvider policyProvider,
     ReferenceProvider referencesProvider,
     IEntityIdProvider <DesignDomain, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <DesignDomain> specProvider = null,
     EntityHandler <DesignDomain, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
     _referenceService = referencesProvider;
     _fsDb             = db;
     _policyProvider   = policyProvider;
 }
Esempio n. 15
0
        /// <summary>
        ///     Creates a new instance.
        /// </summary>
        /// <param name="db">The references database.</param>
        /// <param name="idProvider"></param>
        /// <param name="messagePipe"></param>
        /// <param name="referencesSpec">Rules to validate a given reference entity.</param>
        public UserGroupService(
            FsUnitOfWork db,
            StakeholderService stakeholderService,
            IEntityIdProvider <UserGroup, Guid> idProvider,
            IMessagePipe messagePipe,
            IProvideSpecifications <UserGroup> referencesSpec = null,
            EntityHandler <UserGroup, Guid> entityHandler     = null)
            : base(db, idProvider, messagePipe, referencesSpec, entityHandler)
        {
            Guard.ArgumentNotNull(db, nameof(db));

            _stakeholderService = stakeholderService;
            _db = db;
        }
Esempio n. 16
0
 public ProtocolService(
     FSSecurityContext securityContext,
     ProjectService projectService,
     StakeholderService stakeholderService,
     ReferenceProvider referenceService,
     UnitOfWorkLinq <Protocol, Guid> db,
     IEntityIdProvider <Protocol, Guid> idProvider,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <Protocol> specProvider = null,
     EntityHandler <Protocol, Guid> entityHandler   = null) :
     base(securityContext, referenceService, db, idProvider, messagePipe, specProvider, entityHandler)
 {
     _scenarioProvider   = projectService;
     _stakeholderService = stakeholderService;
 }
Esempio n. 17
0
        public PolicyService(
            FsUnitOfWork db,
            DesignDomainService designDomainService,
            ReferenceProvider referencesProvider,
            IEntityIdProvider <Policy, Guid> keyBinder,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <Policy> specProvider = null,
            EntityHandler <Policy, Guid> entityHandler   = null)
            : base(db, keyBinder, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(referencesProvider, nameof(referencesProvider));

            _referenceService    = referencesProvider;
            _fsDb                = db;
            _designDomainService = designDomainService;
        }
Esempio n. 18
0
        public GDIPlusTools(IStyle style, IMessagePipe mp, RectangleF rect)
        {
            this.style = style;
            this.mp    = mp;

            fillPattern = style.FillPattern;

            DrawingPen   = GetNewPen(style);
            DrawingBrush = GetNewBrush(fillPattern);

            fillPattern.PropertyChanged         += Pattern_PropertyChanged;
            style.BorderPattern.PropertyChanged += BorderPattern_PropertyChanged;

            ExpandRect(ref rect);
            Bounds = rect;
        }
Esempio n. 19
0
        public SoftwareModelInterfaceService(
            FSSecurityContext securityContext,
            ReferenceProvider referencesProvider,
            ProtocolService protocolService,
            ProjectService projectService,
            UnitOfWorkLinq <SoftwareModelInterface, Guid> db,
            IEntityIdProvider <SoftwareModelInterface, Guid> idProvider,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <SoftwareModelInterface> specProvider = null,
            EntityHandler <SoftwareModelInterface, Guid> entityHandler   = null) : base(securityContext, referencesProvider, db, idProvider, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(protocolService, nameof(protocolService));

            _protocolService = protocolService;
            _projectService  = projectService;
        }
Esempio n. 20
0
        public FsService(
            FSSecurityContext securityContext,
            ReferenceProvider referenceProvider,
            IUnitOfWorkLinq <TEntity, Guid> db,
            IEntityIdProvider <TEntity, Guid> idProvider,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <TEntity> specProvider = null,
            EntityHandler <TEntity, Guid> entityHandler   = null) :
            base(db, idProvider, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(db, nameof(db));
            Guard.ArgumentNotNull(referenceProvider, nameof(referenceProvider));
            Guard.ArgumentNotNull(securityContext, nameof(securityContext));

            _securityContext       = securityContext;
            this.referenceProvider = referenceProvider;
        }
Esempio n. 21
0
        /// <summary>
        ///     Creates a new instance given a set of primitive services.
        /// </summary>
        public NetworkService(
            FSSecurityContext securityContext,
            ReferenceProvider referenceProvider,
            BusinessUnitProvider businessUnitProvider,
            StakeholderService stakeholdersService,
            ProtocolService protocolService,
            DeviceModelService deviceModelService,
            DeviceService deviceService,
            DeviceConnectionService deviceConnectionService,
            ApplicationAccessService appAccessService,
            ProjectService projectService,
            FsUnitOfWork db,
            IEntityIdProvider <Network, Guid> idProvider,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <Network> specProvider = null,
            EntityHandler <Network, Guid> entityHandler   = null) : base(securityContext, referenceProvider, db, idProvider, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(stakeholdersService, nameof(stakeholdersService));
            Guard.ArgumentNotNull(protocolService, nameof(protocolService));
            Guard.ArgumentNotNull(deviceService, nameof(deviceService));
            Guard.ArgumentNotNull(deviceConnectionService, nameof(deviceConnectionService));
            Guard.ArgumentNotNull(deviceModelService, nameof(deviceModelService));
            Guard.ArgumentNotNull(projectService, nameof(projectService));
            Guard.ArgumentNotNull(businessUnitProvider, nameof(businessUnitProvider));
            Guard.ArgumentNotNull(appAccessService, nameof(appAccessService));

            // compose device service
            // todo: dependency inject

            //setup and configure service
            _deviceService           = deviceService;
            _appAccessService        = appAccessService;
            _businessUnitService     = businessUnitProvider;
            _projectService          = projectService;
            _deviceModelService      = deviceModelService;
            _protocolService         = protocolService;
            _deviceConnectionService = deviceConnectionService;
            _stakeholderService      = stakeholdersService;

            _db = db;
        }
        //.ctor
        public StakeholderService(
            FSSecurityContext securityContext,
            ProjectService projectService,
            BusinessUnitProvider businessUnitProvider,
            StakeholderLoginProvider stakeholderLoginProvider,
            ReferenceProvider referencesProvider,
            FsUnitOfWork db,
            IMessagePipe messagePipe,
            IEntityIdProvider <Stakeholder, Guid> idProvider,
            IProvideSpecifications <Stakeholder> specProvider = null,
            EntityHandler <Stakeholder, Guid> entityHandler   = null)
            : base(securityContext, referencesProvider, db, idProvider, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(projectService, nameof(projectService));
            Guard.ArgumentNotNull(stakeholderLoginProvider, nameof(stakeholderLoginProvider));

            _db                       = db;
            _projectService           = projectService;
            _businessUnitProvider     = businessUnitProvider;
            _stakeholderLoginProvider = stakeholderLoginProvider;
        }
Esempio n. 23
0
        public DeviceConnectionService(
            FSSecurityContext securityContext,
            ReferenceProvider referenceService,
            StakeholderService stakeholderService,
            UserGroupService userGroupService,
            ProjectService projectService,
            UnitOfWorkLinq <DeviceConnection, Guid> db,
            DeviceService deviceService,
            ProtocolService protocolService,
            IEntityIdProvider <DeviceConnection, Guid> keyBinder,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <DeviceConnection> specProvider = null,
            EntityHandler <DeviceConnection, Guid> entityHandler   = null)
            : base(securityContext, referenceService, db, keyBinder, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(stakeholderService, nameof(stakeholderService));
            Guard.ArgumentNotNull(userGroupService, nameof(userGroupService));

            _deviceService      = deviceService;
            _protocolService    = protocolService;
            _projectService     = projectService;
            _userGroupService   = userGroupService;
            _stakeholderService = stakeholderService;
        }
        private bool ReceiveMessageReceived(Message message)
        {
            IMessagePipe receivePipe = this.ReceivePipe;

            return(receivePipe != null && receivePipe.PostMessage(message));
        }