private void buttonOk_Click(object sender, EventArgs e) { Entity userEntity = CreateUserEntity(); Entity roleEntity = null; //Entity userRoleEntity = null; Entity loginsEntity = null; Entity claimsEntity = null; Entity roleClaimEntity = null; if (checkBoxRole.Checked) { roleEntity = CreateRoleEntity(); } //if (checkBoxUserRole.Checked) //{ // userRoleEntity = CreateUserRoleEntity(); // AddRelation(userEntity, PropertyType.Roles, userRoleEntity, PropertyType.User, RelationType.ManyToOne); // AddRelation(roleEntity, PropertyType.RoleUsers, userRoleEntity, PropertyType.Role, RelationType.ManyToOne); //} //else //{ AddRelation(userEntity, PropertyType.UserRoles, roleEntity, PropertyType.RoleUsers, RelationType.ManyToMany); //} if (checkBoxClaims.Checked) { claimsEntity = CreateUserClaimsEntity(); AddRelation(userEntity, PropertyType.UserClaims, claimsEntity, PropertyType.UserClaimUser, RelationType.ManyToOne); } if (checkBoxExternalLogins.Checked) { loginsEntity = CreateUserLoginsEntity(); AddRelation(userEntity, PropertyType.UserLogins, loginsEntity, PropertyType.UserLoginUser, RelationType.ManyToOne); } if (checkBoxRoleClaim.Checked) { roleClaimEntity = CreateRoleClaimEntity(); AddRelation(roleEntity, PropertyType.RoleClaims, roleClaimEntity, PropertyType.RoleClaimRole, RelationType.ManyToOne); } CreateUserMethods(userEntity, loginsEntity); SetCollectionMode(userEntity); SetCollectionMode(roleEntity); //SetCollectionMode(userRoleEntity); SetCollectionMode(loginsEntity); SetCollectionMode(claimsEntity); SetCollectionMode(roleClaimEntity); if (_aspNetIdentityProducer.MustCreateMessages) { ProjectMessages messages = new ProjectMessages(_project); if (messages.RoleNotFoundMessage == null) { var message = new Message { EditorName = "RoleNotFound", Class = MessageClass._default.ToString(), CultureName = ConvertUtilities.ToCultureInfo(_aspNetIdentityProducer.MessagesCulture, _project.Culture).Name, Value = IdentityRole.RoleNotFoundMessage, AddToRuntimeResourceFile = true }; message.SetAttributeValue("", "messageType", Constants.NamespaceUri, ProjectMessageType.RoleNotFound); _project.Messages.Add(message); } } this.Close(); }