示例#1
0
 public ServiceAttribute(
    Type registerFrom, string injectionParam,
    ServiceScope scope = ServiceScope.Web)
     : base(registerFrom, ServiceBehaviour.NewInstance, scope, ServiceEnvironemnt.Anywhere)
 {
     this.InjectionParam = injectionParam;
 }
示例#2
0
        public void Register <TInterface, TImpl>(ServiceScope scope = ServiceScope.Singleton) where TImpl : TInterface
        {
            var binding = this.Kernel
                          .Bind <TInterface>()
                          .To <TImpl>();

            this.SetBinding(binding, scope);
        }
示例#3
0
 /// <summary>
 /// Retourne un bean à partir d'un critère de recherche.
 /// </summary>
 /// <param name="criteria">Le critère de recherche.</param>
 /// <returns>Bean.</returns>
 /// <exception cref="CollectionBuilderException">Si la recherche renvoie plus d'un élément.</exception>
 /// <exception cref="CollectionBuilderException">Si la recherche ne renvoit pas d'élément.</exception>
 public virtual T GetByCriteria(FilterCriteria criteria)
 {
     using (ServiceScope tx = new ServiceScope(TransactionScopeOption.Required)) {
         T value = _store.LoadByCriteria(null, criteria);
         tx.Complete();
         return(value);
     }
 }
        public ColumnSelect(GridViewTracks grid)
        {
            InitializeComponent();
            this.grid = grid;

            BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor;
            ServiceScope.Get <IThemeManager>().NotifyThemeChange();
        }
示例#5
0
 public Service(
     ServiceScope scope = ServiceScope.Transient,
     Type resolveType   = null
     )
 {
     Scope       = scope;
     ResolveType = resolveType;
 }
示例#6
0
        /// <summary>
        /// Initializes a new instance of a <see cref="ServiceInfo"/> with the given values.
        /// </summary>
        /// <param name="registerAs">The contract of the service.</param>
        /// <param name="type">The type of the service.</param>
        /// <param name="scope">The scope of the service (Global or Module)</param>
        public ServiceInfo(Type registerAs, Type type, string scope)
        {
            Guard.EnumValueIsDefined(typeof(ServiceScope), scope, "scope");

            ServiceScope serviceScope = (ServiceScope)Enum.Parse(typeof(ServiceScope), scope);

            Initialize(registerAs, type, serviceScope);
        }
示例#7
0
        public MPTTabPage()
        {
            themeManager = ServiceScope.Get <IThemeManager>();
            // Setup message queue for receiving Messages
            IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message");

            queueMessage.OnMessageReceive += OnMessageReceive;
        }
示例#8
0
 public ServiceAttribute(
     Type registerFrom,
     ServiceBehaviour behaviour = ServiceBehaviour.NewInstance,
     ServiceScope scope = ServiceScope.Web,
     ServiceEnvironemnt environemnt = ServiceEnvironemnt.Anywhere,
     bool addInterfaceInterceptor = false)
     : base(registerFrom, behaviour, scope, environemnt, addInterfaceInterceptor)
 {
 }
        public FreeDBMultiCDSelect()
        {
            InitializeComponent();

            BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor;
            ServiceScope.Get <IThemeManager>().NotifyThemeChange();

            Text = localisation.ToString("FreeDB", "Header");
        }
示例#10
0
        internal static ICEFList CreateWrappingList(ServiceScope ss, Type sourceType, object host, string propName)
        {
            var setWrapType = Globals.PreferredEntitySetType.MakeGenericType(sourceType.GenericTypeArguments[0]);
            var wrappedCol  = setWrapType.FastCreateNoParm() as ICEFList;

            ((ISupportInitializeNotification)wrappedCol).BeginInit();
            ((ICEFList)wrappedCol).Initialize(ss, host, host.GetBaseType().Name, propName);
            return(wrappedCol);
        }
        public void TearDown()
        {
            ServiceScope?.Dispose();

            if (!string.IsNullOrEmpty(_tempDataDirectory) && Directory.Exists(_tempDataDirectory))
            {
                Directory.Delete(_tempDataDirectory, true);
            }
        }
示例#12
0
        public void Dispose()
        {
            if (!_disposed)
            {
                _disposed = true;

                PopNestedServiceScope();
                ServiceScope.Dispose();
            }
        }
示例#13
0
        public MPTButton()
        {
            themeManager = ServiceScope.Get <IThemeManager>();
            // Setup message queue for receiving Messages
            IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message");

            queueMessage.OnMessageReceive += OnMessageReceive;

            UseVisualStyleBackColor = true;
        }
示例#14
0
 public void RegisterAll <TInterface>(string assembly, ServiceScope scope = ServiceScope.Singleton)
 {
     this.Kernel.Bind(x => x
                      .FromAssembliesMatching(assembly)
                      .SelectAllClasses()
                      .InheritedFrom <TInterface>()
                      .BindToSelf()
                      .Configure(y => this.SetBinding(y, scope))
                      );
 }
示例#15
0
        public override async Task <TResponse> Handle(IRequest <TResponse> request, CancellationToken cancellationToken,
                                                      ServiceScope serviceFactory)
        {
            Task <TResponse> Handler() => serviceFactory.GetHandler <IRequestHandlerAsync <TRequest, TResponse> >().HandleAsync((TRequest)request, cancellationToken);

            return(await serviceFactory
                   .GetInstances <IPipelineBehavior <TRequest, TResponse> >()
                   .Reverse()
                   .Aggregate((RequestHandlerDelegate <TResponse>)Handler, (next, pipeline) => () => pipeline.Handle((TRequest)request, cancellationToken, next))());
        }
示例#16
0
        public PlayList(PlayerControl player)
        {
            _player = player;

            InitializeComponent();

            IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message");

            queueMessage.OnMessageReceive += OnMessageReceive;
        }
        public void ShouldNotCreateServiceWhenDescriptionLessThan10()
        {
            var service = new Service(
                "ab",
                "021991138347",
                "O melhor"
                );

            Assert.AreEqual(false, ServiceScope.ServiceValid(service));
        }
        public void ShouldCreateService()
        {
            var service = new Service(
                "Salão de Beleza Belo Corte",
                "021991138347",
                "O melhor salão de beleza da região. Fazemos todos os tipos de corte. Trabalhamos com pintura e coloração"
                );

            Assert.AreEqual(true, ServiceScope.ServiceValid(service));
        }
        public void ShoulNotCreateServiceWithoutPhone()
        {
            var service = new Service(
                "Salão de Beleza Belo Corte",
                "",
                "O melhor salão de beleza da região. Fazemos todos os tipos de corte. Trabalhamos com pintura e coloração"
                );

            Assert.AreEqual(false, ServiceScope.ServiceValid(service));
        }
        public void ShouldNotCreateServiceWhenTitleLessThan3()
        {
            var service = new Service(
                "ab",
                "021991138347",
                "O melhor salão de beleza da região. Fazemos todos os tipos de corte. Trabalhamos com pintura e coloração"
                );

            Assert.AreEqual(false, ServiceScope.ServiceValid(service));
        }
        public void ShouldNotCreateServiceWithoutDescription()
        {
            var service = new Service(
                "Salão de Beleza Belo Corte",
                "021991138347",
                ""
                );

            Assert.AreEqual(false, ServiceScope.ServiceValid(service));
        }
示例#22
0
        /// <summary>
        /// Retourne tous les beans pour un type suivant
        /// une liste de critères donnés.
        /// </summary>
        /// <param name="criteria">Critères de sélection.</param>
        /// <param name="queryParameter">Paramètres de tri et de limite (vide par défaut).</param>
        /// <returns>Collection.</returns>
        public virtual ICollection <T> GetAllByCriteria(FilterCriteria criteria, QueryParameter queryParameter = null)
        {
            ICollection <T> coll;

            using (ServiceScope tx = new ServiceScope(TransactionScopeOption.Required)) {
                coll = _store.LoadAllByCriteria(null, criteria, queryParameter);
                tx.Complete();
            }

            return(coll);
        }
示例#23
0
 /// <summary>
 /// A Search is performed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btSearch_Click(object sender, EventArgs e)
 {
     _artist = tbArtist.Text;
     _album  = tbAlbum.Text;
     lvSearchResults.Items.Clear();
     imagelist.Images.Clear();
     _albums.Clear();
     groupBoxAmazonMultipleAlbums.Text = ServiceScope.Get <ILocalisation>().ToString("AmazonAlbumSearch", "Searching");
     groupBoxAmazonMultipleAlbums.Refresh();
     DoSearchAlbum();
 }
 static MPTWinControlsCommon()
 {
     try
     {
         localisation = ServiceScope.Get <ILocalisation>();
     }
     catch (ServiceNotFoundException)
     {
         localisation = null;
     }
 }
示例#25
0
 public ServiceDescriptor(Type typeInterface, Type typeClass, ServiceScope scope, ServiceLifeTime lifeTime = ServiceLifeTime.Transient)
 {
     if (typeClass == null)
     {
         throw new ArgumentNullException(nameof(typeClass));
     }
     Scope         = scope;
     TypeInterface = typeInterface;
     TypeClass     = typeClass;
     LifeTime      = lifeTime;
 }
 public void TearDown()
 {
     ServiceScope?.Dispose();
     ServiceProvider?.Dispose();
     if (_temporaryDatabase != null)
     {
         var connString = _temporaryDatabase.ConnectionString;
         _temporaryDatabase = null;
         FbDatabase.DropDatabase(connString);
     }
 }
示例#27
0
        WrappingSupport ICEFService.IdentifyInfraNeeds(object o, object?replaced, ServiceScope ss, bool isNew)
        {
            if ((!string.IsNullOrEmpty(LastUpdatedByField) && !(replaced ?? o).HasProperty(LastUpdatedByField)) ||
                (!string.IsNullOrEmpty(LastUpdatedDateField) && !(replaced ?? o).HasProperty(LastUpdatedDateField)) ||
                (!string.IsNullOrEmpty(IsDeletedField) && !(replaced ?? o).HasProperty(IsDeletedField)))
            {
                return(WrappingSupport.PropertyBag);
            }

            return(WrappingSupport.None);
        }
示例#28
0
 WrappingSupport ICEFService.IdentifyInfraNeeds(object o, object replaced, ServiceScope ss, bool isNew)
 {
     if ((replaced ?? o) is INotifyPropertyChanged)
     {
         return(WrappingSupport.OriginalValues);
     }
     else
     {
         return(WrappingSupport.OriginalValues | WrappingSupport.Notifications);
     }
 }
示例#29
0
        /// <summary>
        /// Charge dans un objet le bean à partir de sa clef primaire.
        /// </summary>
        /// <param name="destination">Objet à charger.</param>
        /// <param name="primaryKey">Valeur de la clef primaire.</param>
        public virtual void Load(T destination, object primaryKey)
        {
            if (primaryKey == null)
            {
                throw new ArgumentNullException("primaryKey");
            }

            using (ServiceScope tx = new ServiceScope(TransactionScopeOption.Required)) {
                _store.Load(destination, primaryKey);
                tx.Complete();
            }
        }
        public ArtistAlbumDialog()
        {
            InitializeComponent();

            BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor;
            ServiceScope.Get <IThemeManager>().NotifyThemeChange();

            labelHeader.ForeColor = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderForeColor;
            labelHeader.Font      = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderFont;

            LocaliseScreen();
        }
示例#31
0
        public WorkerScheduled(string queueName, int batchSize, IJobServiceScopeFactory scopeFactory, IJobLogger <WorkerScheduled> logger)
            : base(queueName, batchSize, 1, true, scopeFactory, logger)
        {
            _timeProvider = ServiceScope.GetRequiredService <ITimeProvider>();

            _timer              = ServiceScope.GetRequiredService <ITimer>();
            _timer.TimeElapsed += CheckScheduledJobs;

            _scheduledJobs    = new ConcurrentDictionary <ulong, JobInfo>();
            _periodicJobs     = new ConcurrentDictionary <string, ulong>();
            _periodicSkipJobs = new ConcurrentDictionary <string, ConcurrentBag <ulong> >();
        }
示例#32
0
        /// <summary>
        /// Loads all configuration data to the treeview "sections".
        /// </summary>
        private void LoadSections()
        {
            IConfigurationManager       manager  = ServiceScope.Get <IConfigurationManager>();
            IEnumerable <ConfigSection> sections = GetSections(manager, "/");

            foreach (ConfigSection section in sections)
            {
                TreeNode node = CreateTreeNode(section);
                LoadSections(manager, section.Metadata.Id, node.Nodes);
                _treeSections.Nodes.Add(node);
            }
        }
 protected ServiceContextAttribute(
     Type registerFrom,
     ServiceBehaviour behaviour = ServiceBehaviour.NewInstance,
     ServiceScope scope = ServiceScope.Web,
     ServiceEnvironemnt environemnt = ServiceEnvironemnt.Anywhere,
     bool addInterfaceInterceptor = false)
 {
     this.RegisterFrom = registerFrom;
     this.Behaviour = behaviour;
     this.Scope = scope;
     this.AddInterfaceInterceptor = addInterfaceInterceptor;
     this.Environment = environemnt;
 }
示例#34
0
        /// <summary>
        ///   Der Unity Container
        /// </summary>
        /// <param name = "scope">Service scope</param>
        /// <returns>Unity Container</returns>
        protected static IUnityContainer GetContainer(ServiceScope scope)
        {
            if (container == null)
            {
                lock (Mlock)
                {
                    if (container == null)
                    {
                        container = RegisterDeclaredServices(scope);
                    }
                }
            }

            return container;
        }
示例#35
0
 public static IEnumerable<ServiceContextAttribute> GetTypes(ServiceScope scope)
 {
     foreach (var assembly in AssemblyLocator.LoadAll())
     {
         foreach (var type in GetAllServiceTypes(assembly))
         {
             foreach (var attribute in type.Attributes.Where(a => a.Scope.HasFlag(scope)))
             {
                 if (ValidateEnvironment(attribute))
                 {
                     attribute.RegisterTo = type.RegisterTo;
                     yield return attribute;
                 }
             }
         }
     }
 }
示例#36
0
        /// <summary>
        ///   Registriert alle Services, welche im angegebenen Scope über das ServiceAttribut
        ///   definiert sind.
        /// </summary>
        /// <param name = "scope">Service Scope</param>
        /// <returns>Der initialisierte Container</returns>
        protected static IUnityContainer RegisterDeclaredServices(ServiceScope scope)
        {
            var unityContainer = new UnityContainer();

            foreach (ServiceContextAttribute type in ServiceAttribute.GetTypes(scope))
            {
                switch (type.Behaviour)
                {
                    case ServiceBehaviour.NewInstance:
                        {
                            if (!string.IsNullOrEmpty(type.InjectionParam))
                                unityContainer.RegisterType(type.RegisterFrom, type.RegisterTo, type.InjectionParam);
                            else
                                unityContainer.RegisterType(type.RegisterFrom, type.RegisterTo);
                            break;
                        }

                    case ServiceBehaviour.Singleton:
                        {
                            var lfmr = new ContainerControlledLifetimeManager();
                            unityContainer.RegisterType(type.RegisterFrom, type.RegisterTo, lfmr);
                            break;
                        }

                    case ServiceBehaviour.Webrequest:
                        {
                            if (scope == ServiceScope.Frontend)
                            {
                                RegisterPerWebRequest(type.RegisterFrom, type.RegisterTo, unityContainer);
                            }
                            else
                            {
                                var lfmr = new ContainerControlledLifetimeManager();
                                unityContainer.RegisterType(type.RegisterFrom, type.RegisterTo, lfmr);
                            }

                            break;
                        }
                }
            }

            return unityContainer;
        }
示例#37
0
 /// <summary>
 /// Initializes a new instance of a <see cref="ServiceInfo"/> with the given values.
 /// </summary>
 /// <param name="registerAs">The contract of the service.</param>
 /// <param name="type">The type of the service.</param>
 /// <param name="scope">The scope of the service (Global or Module)</param>
 public ServiceInfo(Type registerAs, Type type, ServiceScope scope)
 {
     Initialize(registerAs, type, scope);
 }
示例#38
0
 /// <summary>
 /// ע�����
 /// </summary>
 /// <param name="serviceKey">�����ʶ</param>
 /// <param name="serviceName">����</param>
 /// <param name="description">������Ϣ</param>
 /// <param name="serviceType">��������</param>
 /// <param name="type">��������</param>
 private void RegisterService(string serviceKey, string serviceName, string description, ServiceType serviceType, Type type, ServiceScope serviceScope)
 {
     logger.Debug("���յ���ϵͳ[" + serviceName + "]��ע������");
     if (subsystems.ContainsKey(serviceKey)) throw new ArgumentException("SystemManager���Ѿ�����KeyΪ[" + serviceKey + "]����ϵͳ��Ϣ", "subsystemKey");
     subsystems.Add(serviceKey, new ServiceInfo(serviceKey, serviceName, description, serviceType, type, serviceScope));
 }
 /// <summary>
 /// 远程系统服务标签构造函数(重载)
 /// </summary>
 /// <param name="description">服务描述</param>
 /// <param name="serviceScope">服务发布范围</param>
 public RemoteServiceAttribute(string description, ServiceScope serviceScope)
     : this(description, ServiceType.Unknown, serviceScope)
 {
 }
 /// <summary>
 /// 远程系统服务标签构造函数
 /// </summary>
 /// <param name="desctiption">服务描述</param>
 /// <param name="serviceType">类型</param>
 /// <param name="serviceScope">服务发布范围</param>
 public RemoteServiceAttribute(string desctiption, ServiceType serviceType, ServiceScope serviceScope)
 {
     this.description = description;
     this.serviceType = serviceType;
     this.serviceScope = serviceScope;
 }
示例#41
0
 private void Initialize(Type registerAs, Type type, ServiceScope scope)
 {
     _registerAs = registerAs;
     _type = type;
     _scope = scope;
 }
示例#42
0
 /// <summary>
 /// ���캯�������أ�
 /// </summary>
 /// <param name="serviceKey"></param>
 /// <param name="name"></param>
 /// <param name="description"></param>
 /// <param name="serviceType"></param>
 /// <param name="type"></param>
 /// <param name="serviceScope"></param>
 public ServiceInfo(string serviceKey, string name, string description, ServiceType serviceType, Type type, ServiceScope serviceScope)
     : this(serviceKey, name, description, serviceType, type)
 {
     this.serviceScope = serviceScope;
 }
示例#43
0
 public ServiceAttribute(ServiceScope scope)
 {
     ServiceScope = scope;
 }