public static PropertyContextAttributeDiscovery Create(PropertyInfo[] propertyInfo) { var executor = new PropertyContextAttributeDiscovery(propertyInfo); //executor._executor = GetExecutor(propertyInfo); return(executor); }
public static IList <BatchActionDescriptor> getBatchActionDescription(TypeInfo typeInfo, string batchName = null) { IList <BatchActionDescriptor> response = new List <BatchActionDescriptor>(); var batchNameToUse = batchName ?? cleanBatchName(typeInfo.Name); if (typeInfo.BaseType != null && !(typeInfo.BaseType.GetType() == typeof(object))) { response = getBatchActionDescription(typeInfo.BaseType.GetTypeInfo(), batchNameToUse); } if (isBatch(typeInfo)) { //Verify the Context Presence PropertyInfo[] properties = typeInfo.GetProperties(); var propertyDiscovery = PropertyContextAttributeDiscovery.Create(properties); var propertyDiscovered = propertyDiscovery.execute(properties); foreach (var action in typeInfo.DeclaredMethods) { if (isMethod(action)) { var batchActionDescriptor = new BatchActionDescriptor() { Id = typeInfo.Name, BatchName = batchNameToUse, BatchTypeInfo = typeInfo, ActionName = action.Name, ActionInfo = action, PropertyInfo = propertyDiscovered }; batchActionDescriptor.ConfigureAttribute = new List <IBatchConfigAttributeAsync>(); batchActionDescriptor.ConfigureAttribute.AddRange(typeInfo.GetCustomAttributes <BatchConfigAttribute>(true)); batchActionDescriptor.ConfigureAttribute.AddRange(action.GetCustomAttributes <BatchConfigAttribute>(true)); batchActionDescriptor.ExecutionAttribute = new List <IBatchExecutionAttribute>(); batchActionDescriptor.ExecutionAttribute.AddRange(typeInfo.GetCustomAttributes <BatchExecutionAttribute>(true)); batchActionDescriptor.ExecutionAttribute.AddRange(action.GetCustomAttributes <BatchExecutionAttribute>(true)); batchActionDescriptor.ExceptionAttribute = new List <IBatchExceptionAttribute>(); batchActionDescriptor.ExceptionAttribute.AddRange(typeInfo.GetCustomAttributes <BatchExceptionAttribute>(true)); batchActionDescriptor.ExceptionAttribute.AddRange(action.GetCustomAttributes <BatchExceptionAttribute>(true)); executeConfigureAttribute(ref batchActionDescriptor); if (batchActionDescriptor != null) { batchActionDescriptor.refreshBatchNameAndBatchAction(); response.Add(batchActionDescriptor); } } } } return(response); }