Пример #1
0
 public AttributeSpecificationServiceInterceptor(ServiceTypeValidator serviceTypeValidator, AttributeSpecificationValidator attributeSpecificationValidator)
 {
     _serviceTypeValidator            = serviceTypeValidator;
     _attributeSpecificationValidator = attributeSpecificationValidator;
     BuildUp(new Dictionary <string, Action <IInvocation> >
     {
         {
             nameof(CreateAttributeSpecificationAsync),
             x => CreateAttributeSpecificationAsync((ServiceAttributeSpecification)x.Arguments[0])
         },
         {
             nameof(GetAllSpecificationsForTypeAsync),
             x => GetAllSpecificationsForTypeAsync((int)x.Arguments[0])
         },
         {
             nameof(UpdateAttributeSpecificationAsync),
             x => UpdateAttributeSpecificationAsync((ServiceAttributeSpecification)x.Arguments[0])
         },
         {
             nameof(DeleteSpecificationAsync),
             x => DeleteSpecificationAsync((int)x.Arguments[0], (int)x.Arguments[1])
         },
         {
             nameof(GetSingleSpecificationAsync),
             x => GetSingleSpecificationAsync((int)x.Arguments[0], (int)x.Arguments[1])
         }
     });
 }
Пример #2
0
        public Task <ServiceAttributeSpecification> CreateAttributeSpecificationAsync(ServiceAttributeSpecification spec)
        {
            _serviceTypeValidator.ValidateTypeExists(spec.ServiceTypeId);
            _serviceTypeValidator.CanUpdateServiceType();

            AttributeSpecificationValidator.ValidateNameIsSet(spec);
            AttributeSpecificationValidator.ValidateSpecTypeIsSet(spec);

            return(null);
        }