상속: System.Attribute
        /// <summary>
        /// Creates the synchronization attribute from configuration.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <returns>The corresponding synchronization attribute.</returns>
        private SynchronizeAttribute CreateAttributeFromConfig(IConfiguration config)
        {
            SynchronizeAttribute syncAttrib = null;

            if (config != null)
            {
                var contextRef = config.Attributes[Constants.ContextRefAttribute];

                if (contextRef != null)
                {
                    syncAttrib = new SynchronizeAttribute(contextRef);
                }
                else
                {
                    var contextType = config.Attributes[Constants.ContextTypeAttribute];

                    if (contextType != null)
                    {
                        var type = (Type)converter.PerformConversion(contextType, typeof(Type));
                        syncAttrib = new SynchronizeAttribute(type);
                    }
                }

                var useAmbientContext = config.Attributes[Constants.AmbientContextAttribute];

                if (useAmbientContext != null)
                {
                    syncAttrib = syncAttrib ?? new SynchronizeAttribute();
                    syncAttrib.UseAmbientContext = (bool)converter.PerformConversion(useAmbientContext, typeof(bool));
                }
            }

            return(syncAttrib ?? new SynchronizeAttribute());
        }
        /// <summary>
        ///   Adds the synchronized method to the store.
        /// </summary>
        /// <param name = "method">The method.</param>
        /// <param name = "syncAttrib">The method synchronization.</param>
        public void Add(MethodInfo method, SynchronizeAttribute syncAttrib)
        {
            if (syncAttrib.SynchronizeContext == null && defaultSyncAttrib == null)
            {
                throw new FacilityException(
                          String.Format("Method {0} did not specify a synchronization context" +
                                        " and no default was defined.", method));
            }

            method2Att.Add(method, syncAttrib);
        }
예제 #3
0
		/// <summary>
		/// Adds the synchronizaed method to the store.
		/// </summary>
		/// <param name="method">The method.</param>
		/// <param name="syncAttrib">The method synchronization.</param>
		public void Add(MethodInfo method, SynchronizeAttribute syncAttrib)
		{
			if (syncAttrib.SynchronizeContext == null && defaultSyncAttrib == null)
			{
				throw new FacilityException(
					String.Format("Method {0} did not specify a synchronization context" +
					              " and no default was defined.", method));
			}

			method2Att.Add(method, syncAttrib);
		}
		/// <summary>
		///   Creates the synchronization attribute from configuration.
		/// </summary>
		/// <param name = "config">The configuration.</param>
		/// <returns>The corresponding synchronization attribute.</returns>
		private SynchronizeAttribute CreateAttributeFromConfig(IConfiguration config)
		{
			SynchronizeAttribute syncAttrib = null;

			if (config != null)
			{
				var contextRef = config.Attributes[Constants.ContextRefAttribute];

				if (contextRef != null)
				{
					syncAttrib = new SynchronizeAttribute(contextRef);
				}
				else
				{
					var contextType = config.Attributes[Constants.ContextTypeAttribute];

					if (contextType != null)
					{
						var type = converter.PerformConversion<Type>(contextType);
						syncAttrib = new SynchronizeAttribute(type);
					}
				}

				var useAmbientContext = config.Attributes[Constants.AmbientContextAttribute];

				if (useAmbientContext != null)
				{
					syncAttrib = syncAttrib ?? new SynchronizeAttribute();
					syncAttrib.UseAmbientContext = converter.PerformConversion<bool>(useAmbientContext);
				}
			}

			return syncAttrib ?? new SynchronizeAttribute();
		}
 /// <summary>
 ///   Initializes a new instance of the <see cref = "SynchronizeMetaInfo" /> class.
 /// </summary>
 /// <param name = "defaultSyncAttrib">The default synchronization.</param>
 public SynchronizeMetaInfo(SynchronizeAttribute defaultSyncAttrib)
 {
     this.defaultSyncAttrib = defaultSyncAttrib;
     method2Att             = new Dictionary <MethodInfo, SynchronizeAttribute>(MatchByMethodHandle.Instance);
 }
예제 #6
0
		/// <summary>
		/// Creates the synchronization attribute from configuration.
		/// </summary>
		/// <param name="config">The configuration.</param>
		/// <returns>The corresponding synchronization attribute.</returns>
		private SynchronizeAttribute CreateAttributeFromConfig(IConfiguration config)
		{
			SynchronizeAttribute syncAttrib = null;

			if (config != null)
			{
				String contextRef = config.Attributes[Constants.ContextRefAttribute];

				if (contextRef != null)
				{
					syncAttrib = new SynchronizeAttribute(contextRef);
				}
				else
				{
					String contextType = config.Attributes[Constants.ContextTypeAttribute];

					if (contextType != null)
					{
						Type type = (Type) converter.PerformConversion(contextType, typeof(Type));
						syncAttrib = new SynchronizeAttribute(type);
					}
				}
			}

			return syncAttrib ?? new SynchronizeAttribute();
		}
예제 #7
0
		/// <summary>
		/// Initializes a new instance of the <see cref="SynchronizeMetaInfo"/> class.
		/// </summary>
		/// <param name="defaultSyncAttrib">The default synchronization.</param>
		public SynchronizeMetaInfo(SynchronizeAttribute defaultSyncAttrib)
		{
			this.defaultSyncAttrib = defaultSyncAttrib;
			method2Att = new Dictionary<MethodInfo, SynchronizeAttribute>();
		}