示例#1
0
        /// <summary>
        /// Create an Object Visitor instance for the given object instance <br />
        /// 为给定的对象实例创建一个 Object Visitor 实例
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="kind"></param>
        /// <param name="repeatable"></param>
        /// <param name="strictMode"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static IObjectVisitor <T> Create <T>(T instance, AlgorithmKind kind = AlgorithmKind.Precision, bool repeatable = RpMode.REPEATABLE, bool strictMode = StMode.NORMALE)
        {
            TypeAmGuard.RejectSimpleType <T>();
            var options = FillWith(kind, repeatable, strictMode);

            return(ObjectVisitorFactoryCore.CreateForInstance(instance, options));
        }
示例#2
0
        /// <summary>
        /// Create an Object Visitor instance for a given object instance and use the specified verification strategy <br />
        /// 为给定的对象实例创建一个 Object Visitor 实例,并使用指定的验证策略
        /// </summary>
        /// <param name="type"></param>
        /// <param name="instance"></param>
        /// <param name="validationStrategy"></param>
        /// <param name="kind"></param>
        /// <param name="repeatable"></param>
        /// <param name="strictMode"></param>
        /// <typeparam name="TStrategy"></typeparam>
        /// <returns></returns>
        public static IObjectVisitor Create <TStrategy>(Type type, object instance, TStrategy validationStrategy, AlgorithmKind kind = AlgorithmKind.Precision, bool repeatable = RpMode.REPEATABLE, bool strictMode = StMode.NORMALE)
            where TStrategy : class, IValidationStrategy, new()
        {
            TypeAmGuard.RejectSimpleType(type);
            var options = FillWith(kind, repeatable, strictMode);

            return(ObjectVisitorFactoryCore.CreateForInstance(type, instance, options, validationStrategy));
        }
示例#3
0
 /// <summary>
 /// Create an Object Visitor instance for the given type <br />
 /// 为给定的类型创建一个 Object Visitor 实例
 /// </summary>
 /// <param name="type"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IObjectVisitor Create(Type type, ObjectVisitorOptions options)
 {
     TypeAmGuard.RejectSimpleType(type);
     if (type.IsAbstract && type.IsSealed)
     {
         return(ObjectVisitorFactoryCore.CreateForStaticType(type, options));
     }
     return(ObjectVisitorFactoryCore.CreateForFutureInstance(type, options));
 }
示例#4
0
 /// <summary>
 /// Create an Object Visitor instance for the given object instance and initialize it with the given dictionary <br />
 /// 为给定的对象实例创建一个 Object Visitor 实例,并通过给定的字典对其进行初始化
 /// </summary>
 /// <param name="type"></param>
 /// <param name="initialValues"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IObjectVisitor Create(Type type, IDictionary <string, object> initialValues, ObjectVisitorOptions options)
 {
     TypeAmGuard.RejectSimpleType(type);
     if (type.IsAbstract && type.IsSealed)
     {
         return(ObjectVisitorFactoryCore.CreateForStaticType(type, options));
     }
     return(ObjectVisitorFactoryCore.CreateForFutureInstance(type, options, initialValues));
 }
示例#5
0
 /// <summary>
 /// Create an Object Visitor instance for the given object instance,
 /// use the specified verification strategy,
 /// and initialize it with the given dictionary <br />
 /// 为给定的对象实例创建一个 Object Visitor 实例,使用指定的验证策略,并通过给定的字典对其进行初始化
 /// </summary>
 /// <param name="type"></param>
 /// <param name="initialValues"></param>
 /// <param name="validationStrategy"></param>
 /// <param name="options"></param>
 /// <typeparam name="TStrategy"></typeparam>
 /// <returns></returns>
 public static IObjectVisitor Create <TStrategy>(Type type, IDictionary <string, object> initialValues, TStrategy validationStrategy, ObjectVisitorOptions options)
     where TStrategy : class, IValidationStrategy, new()
 {
     TypeAmGuard.RejectSimpleType(type);
     if (type.IsAbstract && type.IsSealed)
     {
         return(ObjectVisitorFactoryCore.CreateForStaticType(type, options, validationStrategy));
     }
     return(ObjectVisitorFactoryCore.CreateForFutureInstance(type, options, validationStrategy, initialValues));
 }
示例#6
0
        /// <summary>
        /// Create an Object Visitor instance for the given type <br />
        /// 为给定的类型创建一个 Object Visitor 实例
        /// </summary>
        /// <param name="type"></param>
        /// <param name="kind"></param>
        /// <param name="repeatable"></param>
        /// <param name="strictMode"></param>
        /// <returns></returns>
        public static IObjectVisitor Create(Type type, AlgorithmKind kind = AlgorithmKind.Precision, bool repeatable = RpMode.REPEATABLE, bool strictMode = StMode.NORMALE)
        {
            TypeAmGuard.RejectSimpleType(type);
            var options = FillWith(kind, repeatable, strictMode);

            if (type.IsAbstract && type.IsSealed)
            {
                return(ObjectVisitorFactoryCore.CreateForStaticType(type, options));
            }
            return(ObjectVisitorFactoryCore.CreateForFutureInstance(type, options));
        }
示例#7
0
        /// <summary>
        /// Create an Object Visitor instance for the given object instance,
        /// use the specified verification strategy,
        /// and initialize it with the given dictionary <br />
        /// 为给定的对象实例创建一个 Object Visitor 实例,使用指定的验证策略,并通过给定的字典对其进行初始化
        /// </summary>
        /// <param name="type"></param>
        /// <param name="initialValues"></param>
        /// <param name="validationStrategy"></param>
        /// <param name="kind"></param>
        /// <param name="repeatable"></param>
        /// <param name="strictMode"></param>
        /// <typeparam name="TStrategy"></typeparam>
        /// <returns></returns>
        public static IObjectVisitor Create <TStrategy>(Type type, IDictionary <string, object> initialValues, TStrategy validationStrategy, AlgorithmKind kind = AlgorithmKind.Precision, bool repeatable = RpMode.REPEATABLE,
                                                        bool strictMode = StMode.NORMALE) where TStrategy : class, IValidationStrategy, new()
        {
            TypeAmGuard.RejectSimpleType(type);
            var options = FillWith(kind, repeatable, strictMode);

            if (type.IsAbstract && type.IsSealed)
            {
                return(ObjectVisitorFactoryCore.CreateForStaticType(type, options, validationStrategy));
            }
            return(ObjectVisitorFactoryCore.CreateForFutureInstance(type, options, validationStrategy, initialValues));
        }
示例#8
0
 /// <summary>
 /// Create an Object Visitor instance for a given object instance and use the specified verification strategy <br />
 /// 为给定的对象实例创建一个 Object Visitor 实例,并使用指定的验证策略
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="options"></param>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TStrategy"></typeparam>
 /// <returns></returns>
 public static IObjectVisitor <T> Create <T, TStrategy>(T instance, ObjectVisitorOptions options)
     where TStrategy : class, IValidationStrategy <T>, new()
 {
     TypeAmGuard.RejectSimpleType <T>();
     return(ObjectVisitorFactoryCore.CreateForInstance <T, TStrategy>(instance, options));
 }
示例#9
0
 /// <summary>
 /// Create an Object Visitor instance for a given object instance and use the specified verification strategy <br />
 /// 为给定的对象实例创建一个 Object Visitor 实例,并使用指定的验证策略
 /// </summary>
 /// <param name="type"></param>
 /// <param name="instance"></param>
 /// <param name="validationStrategy"></param>
 /// <param name="options"></param>
 /// <typeparam name="TStrategy"></typeparam>
 /// <returns></returns>
 public static IObjectVisitor Create <TStrategy>(Type type, object instance, TStrategy validationStrategy, ObjectVisitorOptions options)
     where TStrategy : class, IValidationStrategy, new()
 {
     TypeAmGuard.RejectSimpleType(type);
     return(ObjectVisitorFactoryCore.CreateForInstance(type, instance, options, validationStrategy));
 }
示例#10
0
 /// <summary>
 /// Create an Object Visitor instance for the given object instance <br />
 /// 为给定的对象实例创建一个 Object Visitor 实例
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="options"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static IObjectVisitor <T> Create <T>(T instance, ObjectVisitorOptions options)
 {
     TypeAmGuard.RejectSimpleType <T>();
     return(ObjectVisitorFactoryCore.CreateForInstance(instance, options));
 }
示例#11
0
 /// <summary>
 /// Create an Object Visitor instance for the given object instance <br />
 /// 为给定的对象实例创建一个 Object Visitor 实例
 /// </summary>
 /// <param name="type"></param>
 /// <param name="instance"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IObjectVisitor Create(Type type, object instance, ObjectVisitorOptions options)
 {
     TypeAmGuard.RejectSimpleType(type);
     return(ObjectVisitorFactoryCore.CreateForInstance(type, instance, options));
 }