Castle.Facilities.AutomaticTransactionManagement.TransactionMetaInfoStore.GetMetaFor C# (CSharp) 메소드

GetMetaFor() 공개 메소드

public GetMetaFor ( Type implementation ) : TransactionMetaInfo
implementation System.Type
리턴 TransactionMetaInfo
		public TransactionMetaInfo GetMetaFor(Type implementation)
		{
			return (TransactionMetaInfo)type2MetaInfo[implementation];
		}

Usage Example

        /// <summary>
        /// Validates the type is OK to generate a proxy.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="store">The store.</param>
        private void Validate(ComponentModel model, TransactionMetaInfoStore store)
        {
            if (model.Service == null || model.Service.IsInterface)
            {
                return;
            }

            TransactionMetaInfo meta = store.GetMetaFor(model.Implementation);

            if (meta == null)
            {
                return;
            }

            ArrayList problematicMethods = new ArrayList();

            foreach(MethodInfo method in meta.Methods)
            {
                if (!method.IsVirtual)
                {
                    problematicMethods.Add(method.Name);
                }
            }

            if (problematicMethods.Count != 0)
            {
                String[] methodNames = (String[]) problematicMethods.ToArray(typeof(String));

                String message = String.Format("The class {0} wants to use transaction interception, " +
                                               "however the methods must be marked as virtual in order to do so. Please correct " +
                                               "the following methods: {1}", model.Implementation.FullName,
                                               String.Join(", ", methodNames));

                throw new FacilityException(message);
            }
        }
All Usage Examples Of Castle.Facilities.AutomaticTransactionManagement.TransactionMetaInfoStore::GetMetaFor