コード例 #1
0
        public void Extend(Type commandType, string propertyName, Observable observable)
        {
            var property = commandType.GetProperty(propertyName.ToPascalCase());
            if (property != null)
            {
                var type = property.PropertyType;
                if (type.IsConcept()) type = type.GetConceptValueType();

                var clientType = string.Empty;

                if (type == typeof(byte) ||
                    type == typeof(Int16) ||
                    type == typeof(Int32) ||
                    type == typeof(Int64) ||
                    type == typeof(UInt16) ||
                    type == typeof(UInt32) ||
                    type == typeof(UInt64))
                {
                    clientType = "Number";
                }
                else if (type == typeof(DateTime))
                {
                    clientType = "Date";
                }

                if (!string.IsNullOrEmpty(clientType)) observable.ExtendWith("typeConverter", string.Format("\"{0}\"",clientType));
            }
        }
コード例 #2
0
 public void Extend(Type commandType, string propertyName, Observable observable)
 {
     var metaData = _validationMetaData.GetMetaDataFor(commandType);
     if (metaData.Properties.ContainsKey(propertyName))
     {
         var options = JsonConvert.SerializeObject(metaData.Properties[propertyName],
             new JsonSerializerSettings { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() });
         observable.ExtendWith("validation", options);
     }
 }
コード例 #3
0
 public void Extend(Type commandType, string propertyName, Observable observable)
 {
     var inputValidator = _commandValidatorProvider.GetInputValidatorFor(commandType) as IValidator;
     if (inputValidator != null)
     {
         var metaData = _validationMetaDataGenerator.GenerateFrom(inputValidator);
         if (metaData.Properties.ContainsKey(propertyName))
         {
             var options = JsonConvert.SerializeObject(metaData.Properties[propertyName],
                 new JsonSerializerSettings { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() });
             observable.ExtendWith("validation", options);
         }
     }
 }