public RoleStoreProducer(AspNetIdentityProducer aspNetIdentityProducer, CodeDomBaseProducer codeDomBaseProducer, IdentityRole identityRole, IdentityRoleClaim identityRoleClaim)
            : base(aspNetIdentityProducer, codeDomBaseProducer)
        {
            if (aspNetIdentityProducer == null) throw new ArgumentNullException("aspNetIdentityProducer");
            if (identityRole == null) throw new ArgumentNullException("identityRole");

            _aspNetIdentityProducer = aspNetIdentityProducer;
            IdentityRoleClaim = identityRoleClaim;
            IdentityRole = identityRole;
        }
        public RoleStoreProducer(AspNetIdentityProducer aspNetIdentityProducer, CodeDomBaseProducer codeDomBaseProducer, IdentityRole identityRole, IdentityRoleClaim identityRoleClaim)
            : base(aspNetIdentityProducer, codeDomBaseProducer)
        {
            if (aspNetIdentityProducer == null)
            {
                throw new ArgumentNullException("aspNetIdentityProducer");
            }
            if (identityRole == null)
            {
                throw new ArgumentNullException("identityRole");
            }

            _aspNetIdentityProducer = aspNetIdentityProducer;
            IdentityRoleClaim       = identityRoleClaim;
            IdentityRole            = identityRole;
        }
Beispiel #3
0
        public override void Initialize(Project project, Producer producer)
        {
            base.Initialize(project, producer);

            if (InputProducer == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(EditorTargetDirectory))
            {
                EditorTargetDirectory = InputProducer.EditorTargetDirectory;
            }

            InputProducer.CodeDomProduction += CodeDomProducer_CodeDomProduction;


            Entity userEntity = ProjectUtilities.FindByEntityType(project, EntityType.User);

            if (userEntity != null)
            {
                _identityUser = new IdentityUser(userEntity);
            }

            Entity roleEntity = ProjectUtilities.FindByEntityType(project, EntityType.Role);

            if (roleEntity != null)
            {
                _identityRole = new IdentityRole(roleEntity);
            }

            Entity loginEntity = ProjectUtilities.FindByEntityType(project, EntityType.UserLogin);

            if (loginEntity != null)
            {
                _identityUserLogin = new IdentityUserLogin(loginEntity);
            }

            Entity claimEntity = ProjectUtilities.FindByEntityType(project, EntityType.UserClaim);

            if (claimEntity != null)
            {
                _identityUserClaim = new IdentityUserClaim(claimEntity);
            }

            Entity roleClaimEntity = ProjectUtilities.FindByEntityType(project, EntityType.RoleClaim);

            if (roleClaimEntity != null)
            {
                _identityRoleClaim = new IdentityRoleClaim(roleClaimEntity);
            }

            ProjectMessages projectMessages = new ProjectMessages(project);

            if (TargetVersion == AspNetIdentityVersion.Version1 || TargetVersion == AspNetIdentityVersion.Version2)
            {
                if (_identityUser != null)
                {
                    _userStoreProducer = new UserStoreProducer(InputProducer, this, projectMessages, _identityUser, _identityRole, _identityUserLogin, _identityUserClaim);
                }

                if (_identityRole != null)
                {
                    _roleStoreProducer = new RoleStoreProducer(InputProducer, this, _identityRole);
                }
            }
            else if (TargetVersion == AspNetIdentityVersion.Version3)
            {
                if (_identityUser != null)
                {
                    _userStore3Producer = new UserStore3Producer(InputProducer, this, projectMessages, _identityUser, _identityRole, _identityUserLogin, _identityUserClaim);
                }

                if (_identityRole != null)
                {
                    _roleStore3Producer = new RoleStore3Producer(InputProducer, this, _identityRole, _identityRoleClaim);
                }
            }
        }
        public override void Initialize(Project project, Producer producer)
        {
            base.Initialize(project, producer);

            if (InputProducer == null)
                return;

            if (Utilities.IsNullOrWhiteSpace(EditorTargetDirectory))
            {
                EditorTargetDirectory = InputProducer.EditorTargetDirectory;
            }

            InputProducer.CodeDomProduction += CodeDomProducer_CodeDomProduction;


            Entity userEntity = ProjectUtilities.FindByEntityType(project, EntityType.User);
            if (userEntity != null)
            {
                _identityUser = new IdentityUser(userEntity);
            }

            Entity roleEntity = ProjectUtilities.FindByEntityType(project, EntityType.Role);
            if (roleEntity != null)
            {
                _identityRole = new IdentityRole(roleEntity);
            }

            Entity loginEntity = ProjectUtilities.FindByEntityType(project, EntityType.UserLogin);
            if (loginEntity != null)
            {
                _identityUserLogin = new IdentityUserLogin(loginEntity);
            }

            Entity claimEntity = ProjectUtilities.FindByEntityType(project, EntityType.UserClaim);
            if (claimEntity != null)
            {
                _identityUserClaim = new IdentityUserClaim(claimEntity);
            }

            Entity roleClaimEntity = ProjectUtilities.FindByEntityType(project, EntityType.RoleClaim);
            if (roleClaimEntity != null)
            {
                _identityRoleClaim = new IdentityRoleClaim(roleClaimEntity);
            }

            ProjectMessages projectMessages = new ProjectMessages(project);

            if (_identityUser != null)
            {
                _userStoreProducer = new UserStoreProducer(this, InputProducer, projectMessages, _identityUser, _identityRole, _identityUserLogin, _identityUserClaim);
            }

            if (_identityRole != null)
            {
                _roleStoreProducer = new RoleStoreProducer(this, InputProducer, _identityRole, _identityRoleClaim);
            }
        }