Пример #1
0
        public override void Initialize(Project project, Producer producer)
        {
            base.Initialize(project, producer);

            _codeDomProducer = project.Producers.GetProducerInstance <CodeDomProducer>();
            if (_codeDomProducer == null)
            {
                return;
            }

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

            _codeDomProducer.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.Login);

            if (loginEntity != null)
            {
                _identityLogin = new IdentityLogin(loginEntity);
            }

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

            if (claimEntity != null)
            {
                _identityClaim = new IdentityClaim(claimEntity);
            }

            if (_identityUser != null)
            {
                _userStoreProducer = new UserStoreProducer(_codeDomProducer, this, _identityUser, _identityRole, _identityLogin, _identityClaim);
            }

            if (_identityRole != null)
            {
                _roleStoreProducer = new RoleStoreProducer(_codeDomProducer, this, _identityRole);
            }
        }
        public UserStoreProducer(
            CodeDomBaseProducer codeDomBaseProducer,
            AspNetIdentityProducer aspNetIdentityProducer,
            IdentityUser identityUser,
            IdentityRole identityRole,
            IdentityLogin identityLogin,
            IdentityClaim identityClaim)
            : base(codeDomBaseProducer)
        {
            if (aspNetIdentityProducer == null) throw new ArgumentNullException("aspNetIdentityProducer");
            if (identityUser == null) throw new ArgumentNullException("identityUser");

            _aspNetIdentityProducer = aspNetIdentityProducer;
            _identityUser = identityUser;
            _identityRole = identityRole;
            _identityLogin = identityLogin;
            _identityClaim = identityClaim;
        }
Пример #3
0
        public UserStoreProducer(
            CodeDomBaseProducer codeDomBaseProducer,
            AspNetIdentityProducer aspNetIdentityProducer,
            IdentityUser identityUser,
            IdentityRole identityRole,
            IdentityLogin identityLogin,
            IdentityClaim identityClaim)
            : base(codeDomBaseProducer)
        {
            if (aspNetIdentityProducer == null)
            {
                throw new ArgumentNullException("aspNetIdentityProducer");
            }
            if (identityUser == null)
            {
                throw new ArgumentNullException("identityUser");
            }

            _aspNetIdentityProducer = aspNetIdentityProducer;
            _identityUser           = identityUser;
            _identityRole           = identityRole;
            _identityLogin          = identityLogin;
            _identityClaim          = identityClaim;
        }
        public override void Initialize(Project project, Producer producer)
        {
            base.Initialize(project, producer);

            _codeDomProducer = project.Producers.GetProducerInstance<CodeDomProducer>();
            if (_codeDomProducer == null)
                return;

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

            _codeDomProducer.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.Login);
            if (loginEntity != null)
            {
                _identityLogin = new IdentityLogin(loginEntity);
            }

            Entity claimEntity = ProjectUtilities.FindByEntityType(project, EntityType.Claim);
            if (claimEntity != null)
            {
                _identityClaim = new IdentityClaim(claimEntity);
            }

            if (_identityUser != null)
            {
                _userStoreProducer = new UserStoreProducer(_codeDomProducer, this, _identityUser, _identityRole, _identityLogin, _identityClaim);
            }

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