Esempio n. 1
0
        internal static void InitializeRoleProvider(
            SimpleRoleProvider simpleRoles,
            DatabaseConnectionInfo connect,
            string userTableName,
            string userIdColumn,
            string userNameColumn,
            bool createTables,
            SimpleMembershipProviderCasingBehavior casingBehavior)
        {
            if (simpleRoles.InitializeCalled)
            {
                throw new InvalidOperationException(WebDataResources.Security_InitializeAlreadyCalled);
            }

            simpleRoles.CasingBehavior = casingBehavior;
            simpleRoles.ConnectionInfo = connect;
            simpleRoles.UserTableName  = userTableName;
            simpleRoles.UserIdColumn   = userIdColumn;
            simpleRoles.UserNameColumn = userNameColumn;

            if (createTables)
            {
                simpleRoles.CreateTablesIfNeeded();
            }
            simpleRoles.InitializeCalled = true;
        }
Esempio n. 2
0
        private static SimpleRoleProvider CreateDefaultSimpleRoleProvider(string name, RoleProvider currentDefault)
        {
            var roleProvider           = new SimpleRoleProvider(previousProvider: currentDefault);
            NameValueCollection config = new NameValueCollection();

            roleProvider.Initialize(name, config);
            return(roleProvider);
        }
Esempio n. 3
0
        private static void InitializeProviders(
            DatabaseConnectionInfo connect,
            string userTableName,
            string userIdColumn,
            string userNameColumn,
            bool autoCreateTables,
            SimpleMembershipProviderCasingBehavior casingBehavior)
        {
            SimpleMembershipProvider simpleMembership = Membership.Provider as SimpleMembershipProvider;

            if (simpleMembership != null)
            {
                InitializeMembershipProvider(simpleMembership, connect, userTableName, userIdColumn, userNameColumn, autoCreateTables, casingBehavior);
            }

            SimpleRoleProvider simpleRoles = Roles.Provider as SimpleRoleProvider;

            if (simpleRoles != null)
            {
                InitializeRoleProvider(simpleRoles, connect, userTableName, userIdColumn, userNameColumn, autoCreateTables, casingBehavior);
            }

            Initialized = true;
        }