/// <summary>
 /// Adds a custom data-type handler
 /// </summary>
 /// <param name="type">Data-type to be handled</param>
 /// <param name="setter">Setter of the custom data-type</param>
 /// <param name="validator">Validator of the custom data-type</param>
 internal void AddCustomDataTypeHandler(Type type, PropertyServiceCustomDataTypeGetter setter, PropertyServiceCustomDataTypeValidator validator)
 {
     this.PropertyService.AddCustomDataTypeHandler(type, setter, validator);
 }
Exemple #2
0
 /// <summary>
 /// Creates a new instance of the custom data-type handler
 /// </summary>
 /// <param name="getter">Getter for custom data-type property</param>
 /// <param name="validator">validator for custom data-type property</param>
 public CustomDataTypeHandler(PropertyServiceCustomDataTypeGetter getter, PropertyServiceCustomDataTypeValidator validator)
 {
     this.Getter    = getter ?? throw new ArgumentNullException(nameof(getter));
     this.Validator = validator ?? throw new ArgumentNullException(nameof(validator));
 }
 /// <summary>
 /// Registers a handler for a custom data-type property
 /// </summary>
 /// <param name="type">Data-type to be handled</param>
 /// <param name="setter">Setter of the custom data-type</param>
 /// <param name="validator">Validator of the custom data-type</param>
 public void RegisterCustomDataTypeHandler(Type type, PropertyServiceCustomDataTypeGetter setter, PropertyServiceCustomDataTypeValidator validator)
 {
     this.AddCustomDataTypeHandler(type, setter, validator);
 }
Exemple #4
0
        /// <summary>
        /// Adds a custom handler for a custom data-type
        /// </summary>
        /// <param name="type">Data type of the custom handler</param>
        /// <param name="getter">Getter of the custom handler</param>
        /// <param name="validator">Validator of the custom handler</param>
        public void AddCustomDataTypeHandler(Type type, PropertyServiceCustomDataTypeGetter getter, PropertyServiceCustomDataTypeValidator validator)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (getter == null)
            {
                throw new ArgumentNullException(nameof(getter));
            }

            if (validator == null)
            {
                throw new ArgumentNullException(nameof(validator));
            }

            this.CustomDataTypeHandlers.Add(type.GetType(), new CustomDataTypeHandler(getter, validator));
        }