Наследование: System.MarshalByRefObject
Пример #1
0
		public TransactionMetaInfo CreateMetaFromType(Type implementation)
		{
			TransactionMetaInfo metaInfo = new TransactionMetaInfo();

			PopulateMetaInfoFromType(metaInfo, implementation);

			Register(implementation, metaInfo);

			return metaInfo;
		}
Пример #2
0
		private void PopulateMetaInfoFromType(TransactionMetaInfo metaInfo, Type implementation)
		{
			if (implementation == typeof(object) || implementation == typeof(MarshalByRefObject)) return;

			MethodInfo[] methods = implementation.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);

			foreach (MethodInfo method in methods)
			{
				object[] atts = method.GetCustomAttributes(typeof(TransactionAttribute), true);

				if (atts.Length != 0)
				{
					metaInfo.Add(method, atts[0] as TransactionAttribute);
				}
			}

			PopulateMetaInfoFromType(metaInfo, implementation.BaseType);
		}
Пример #3
0
		public TransactionMetaInfo CreateMetaFromConfig(Type implementation, MethodInfo[] methods, IConfiguration config)
		{
			TransactionMetaInfo metaInfo = GetMetaFor(implementation);

			if (metaInfo == null)
			{
				metaInfo = new TransactionMetaInfo();
			}

			foreach (MethodInfo method in methods)
			{
				String transactionMode = config.Attributes[TransactionModeAtt];
				String isolationLevel = config.Attributes[IsolationModeAtt];

				TransactionMode mode = ObtainTransactionMode(implementation, method, transactionMode);
				IsolationMode level = ObtainIsolation(implementation, method, isolationLevel);

				metaInfo.Add(method, new TransactionAttribute(mode, level));
			}

			Register(implementation, metaInfo);

			return metaInfo;
		}
Пример #4
0
		/// <summary>
		/// Sets the intercepted component's ComponentModel.
		/// </summary>
		/// <param name="target">The target's ComponentModel</param>
		public void SetInterceptedComponentModel(ComponentModel target)
		{
			metaInfo = infoStore.GetMetaFor(target.Implementation);
		}
Пример #5
0
		private void Register(Type implementation, TransactionMetaInfo metaInfo)
		{
			type2MetaInfo[implementation] = metaInfo;
		}