public override void Initialize(string name, NameValueCollection config)
        {
            _log.Trace(m => m("MembershipProvider initalization started"));

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(name))
            {
                name = "BuildingBlocks.MembershipProvider";
            }

            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Simple membership provider");
            }

            _minRequiredPasswordLength            = config.GetOf <int?>("minRequiredPasswordLength", validator: ShouldBePositive);
            _minRequiredNonAlphanumericCharacters = config.GetOf <int?>("minRequiredNonalphanumericCharacters", validator: ShouldBePositive);
            _maxInvalidPasswordAttempts           = config.GetOf <int?>("maxInvalidPasswordAttempts", validator: ShouldBePositive);
            _passwordAttemptWindow = config.GetOf <int?>("passwordAttemptWindow", validator: ShouldBePositive);

            base.Initialize(name, config);

            ApplicationName = !string.IsNullOrEmpty(config["applicationName"])
                ? config["applicationName"]
                : ProviderHelpers.GetDefaultAppName();

            _log.Trace(m => m("MembershipProvider with name {0} sucessfully initalized", name));
        }
Esempio n. 2
0
        public override void Initialize(string name, NameValueCollection config)
        {
            _log.Trace(m => m("Initialization started"));

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(name))
            {
                name = "BuildingBlocks.RoleProvider";
            }

            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Simple role provider");
            }

            base.Initialize(name, config);

            ApplicationName = !string.IsNullOrEmpty(config["applicationName"])
                ? config["applicationName"]
                : ProviderHelpers.GetDefaultAppName();

            _log.Trace(m => m("Initialization succedded with provider name \"{0}\"", name));
        }