Ejemplo n.º 1
0
        /// <summary>
        /// Get registrar for the given provider and continue to register <br />
        /// 为给定的验证服务提供者程序提供一个注册器,并继续注册
        /// </summary>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static IValidationRegistrar Continue()
        {
            var provider = ValidationMe.ExposeValidationProvider();

            if (provider is null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            var name = ((ICorrectProvider)provider).Name;
            var mode = ValidationProvider.IsDefault(name) ? RegisterMode.Direct : RegisterMode.Hosted;

            return(new InternalValidationRegistrar(provider, mode, name));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get registrar for the given provider and continue to register <br />
        /// 为给定的验证服务提供者程序提供一个注册器,并继续注册
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public static IValidationRegistrar Continue(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(Continue());
            }

            if (ValidationProvider.IsDefault(name))
            {
                return(DefaultRegistrar);
            }

            var provider = ValidationMe.ExposeValidationProvider(name);

            if (provider is null)
            {
                throw new InvalidOperationException($"There's no such name '{name}' for Validation Provider.");
            }

            name = ((ICorrectProvider)provider).Name;

            return(new InternalValidationRegistrar(provider, RegisterMode.Hosted, name));
        }
Ejemplo n.º 3
0
        internal static IValidationRegistrar ContinueOrDefault(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(Continue());
            }

            if (ValidationProvider.IsDefault(name))
            {
                return(DefaultRegistrar);
            }

            var provider = ValidationMe.ExposeValidationProvider(name);

            if (provider is null)
            {
                provider = ValidationMe.ExposeValidationProvider();
            }

            name = ((ICorrectProvider)provider).Name;

            return(new InternalValidationRegistrar(provider, RegisterMode.Hosted, name));
        }
Ejemplo n.º 4
0
 public ValidationOptions GetOptions(string providerName) => ((ICorrectProvider)ValidationMe.ExposeValidationProvider(providerName)).ExposeValidationOptions().DeepCopy();
Ejemplo n.º 5
0
 public ValidationOptions GetOptions() => ((ICorrectProvider)ValidationMe.ExposeValidationProvider()).ExposeValidationOptions().DeepCopy();