private static void Process(MemberInfo member, ISpecification holder) { var attribute = member.GetCustomAttribute <PresentationHintAttribute>(); FacetUtils.AddFacet(Create(attribute, holder)); }
private static void Process(MemberInfo member, ISpecification holder) { Attribute attribute = member.GetCustomAttribute <StringLengthAttribute>() ?? (Attribute)member.GetCustomAttribute <MaxLengthAttribute>(); FacetUtils.AddFacet(Create(attribute, holder)); }
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) { var attribute = type.GetCustomAttribute <PresentationHintAttribute>(); FacetUtils.AddFacet(Create(attribute, specification)); }
public override IImmutableDictionary<string, ITypeSpecBuilder> Process(IReflector reflector, Type type, IMethodRemover remover, ISpecificationBuilder specification, IImmutableDictionary<string, ITypeSpecBuilder> metamodel) { var facets = new List<IFacet>(); var methods = new List<MethodInfo>(); MethodInfo method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.CreatedMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new CreatedCallbackFacetViaMethod(method, specification)); } else { facets.Add(new CreatedCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.PersistingMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new PersistingCallbackFacetViaMethod(method, specification)); } else { facets.Add(new PersistingCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.PersistedMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new PersistedCallbackFacetViaMethod(method, specification)); } else { facets.Add(new PersistedCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.UpdatingMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new UpdatingCallbackFacetViaMethod(method, specification)); } else { facets.Add(new UpdatingCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.UpdatedMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new UpdatedCallbackFacetViaMethod(method, specification)); } else { facets.Add(new UpdatedCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.LoadingMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new LoadingCallbackFacetViaMethod(method, specification)); } else { facets.Add(new LoadingCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.LoadedMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new LoadedCallbackFacetViaMethod(method, specification)); } else { facets.Add(new LoadedCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.DeletingMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new DeletingCallbackFacetViaMethod(method, specification)); } else { facets.Add(new DeletingCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.DeletedMethod, typeof(void), Type.EmptyTypes); if (method != null) { methods.Add(method); facets.Add(new DeletedCallbackFacetViaMethod(method, specification)); } else { facets.Add(new DeletedCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.OnUpdatingErrorMethod, typeof(string), new[] {typeof(Exception)}); if (method != null) { methods.Add(method); facets.Add(new OnUpdatingErrorCallbackFacetViaMethod(method, specification)); } else { facets.Add(new OnUpdatingErrorCallbackFacetNull(specification)); } method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.OnPersistingErrorMethod, typeof(string), new[] {typeof(Exception)}); if (method != null) { methods.Add(method); facets.Add(new OnPersistingErrorCallbackFacetViaMethod(method, specification)); } else { facets.Add(new OnPersistingErrorCallbackFacetNull(specification)); } remover.RemoveMethods(methods); FacetUtils.AddFacets(facets); return metamodel; }
public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) { Attribute attribute = type.GetCustomAttribute <StringLengthAttribute>() ?? (Attribute)type.GetCustomAttribute <MaxLengthAttribute>(); FacetUtils.AddFacet(Create(attribute, specification)); }
public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) { ParameterInfo parameter = method.GetParameters()[paramNum]; FacetUtils.AddFacet(parameter.ParameterType.IsPrimitive ? CreateMandatory(holder) : CreateOptional(holder)); }
public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification) { Attribute attribute = property.GetCustomAttribute <ConcurrencyCheckAttribute>(); FacetUtils.AddFacet(Create(attribute, specification)); }
public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) { FacetUtils.AddFacet(method.ReturnType.IsPrimitive ? CreateMandatory(specification) : CreateOptional(specification)); }
public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification) { FacetUtils.AddFacet(property.PropertyType.IsPrimitive || property.GetGetMethod() == null ? CreateMandatory(specification) : CreateOptional(specification)); }
public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) { FacetUtils.AddFacet(Create(specification)); return(metamodel); }
public override IImmutableDictionary <string, ITypeSpecBuilder> ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) { FacetUtils.AddFacet(Create(holder)); return(metamodel); }
public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) { var attribute = method.GetCustomAttribute <EagerlyAttribute>(); FacetUtils.AddFacet(Create(attribute, specification)); }
public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) { FacetUtils.AddFacet(property.PropertyType.IsPrimitive || !property.HasPublicGetter() ? CreateMandatory(specification) : CreateOptional(specification)); return(metamodel); }
public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel) { FacetUtils.AddFacet(method.ReturnType.IsPrimitive ? CreateMandatory(specification) : CreateOptional(specification)); return(metamodel); }
public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) { FacetUtils.AddFacet(Create(holder)); }
public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) { FacetUtils.AddFacet(Create(specification)); }