﻿/****** Object:  View [dbo].[v_UserRolesClaims]    Script Date: 17/03/2023 08:48:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE VIEW [dbo].[v_UserRolesClaims]
AS
SELECT 
	dbo.AspNetUsers.Id AS UserId
	,dbo.AspNetUsers.UserName
	,dbo.AspNetUsers.Email
	,ISNULL(dbo.AspNetUserRoles.RoleId, '') as RoleId
	,ISNULL(dbo.AspNetRoles.Name, '') as RoleName
	--,dbo.AspNetRoles.Id
	--,dbo.AspNetRoles.NormalizedName
	--,dbo.AspNetRoles.ConcurrencyStamp
	--,dbo.AspNetUserRoles.UserId 
	--,dbo.AspNetUsers.NormalizedUserName
	--,dbo.AspNetUsers.NormalizedEmail
	--,dbo.AspNetUsers.EmailConfirmed
	--,dbo.AspNetUsers.PasswordHash
	--,dbo.AspNetUsers.SecurityStamp
	--,dbo.AspNetUsers.ConcurrencyStamp AS Expr2
	--,dbo.AspNetUsers.PhoneNumber
	--,dbo.AspNetUsers.PhoneNumberConfirmed
	--,dbo.AspNetUsers.TwoFactorEnabled
	--,dbo.AspNetUsers.LockoutEnd
	--,dbo.AspNetUsers.LockoutEnabled
	--,dbo.AspNetUsers.AccessFailedCount
	--,dbo.AspNetUserClaims.Id AS Expr3
	--,dbo.AspNetUserClaims.UserId AS Expr4
	--,dbo.AspNetUserClaims.ClaimType
	--,dbo.AspNetUserClaims.ClaimValue
FROM dbo.AspNetRoles
INNER JOIN dbo.AspNetUserRoles ON dbo.AspNetRoles.Id = dbo.AspNetUserRoles.RoleId
RIGHT OUTER JOIN dbo.AspNetUsers ON dbo.AspNetUserRoles.UserId = dbo.AspNetUsers.Id
--LEFT OUTER JOIN dbo.AspNetUserClaims ON dbo.AspNetUsers.Id = dbo.AspNetUserClaims.UserId
GO