Skip to content

SCIMSchemaAttributeModel does not always have SchemaId column set #25

@bzuidgeest

Description

@bzuidgeest

It seems that in SCIMSchemaAttributeModel, the SchemaId column is not set for subattributes with the schema Id but just null. I can use a recursive query to get the complete list of attributes in a schema. But having schemaId always filled with schemaId would make getting a complete attribute list for a schema much more efficient.

Same goes for RepresentationId in SCIMRepresentationAttributeLst. If it was filled in everywhere, I could do the query for getting all attributes without recursion, making the example query below more simple.

;WITH RepresentationAttribute 
AS
(
    SELECT * 
	FROM [SCIMRepresentationAttributeLst]
	WHERE RepresentationId IS NOT NULL
    
	UNION ALL

    SELECT child.Id,
		child.ParentId,
		child.SchemaAttributeId,
		CASE WHEN Child.RepresentationId IS NULL THEN parent.RepresentationId ELSE Child.RepresentationId END AS RepresentationId  
	FROM [SCIMRepresentationAttributeLst] AS child
		INNER JOIN RepresentationAttribute AS parent ON child.parentId = parent.id
)
SELECT 
	[SCIMRepresentationLst].Id,
	[SCIMRepresentationLst].ExternalId,
	RepresentationAttribute.*
	,SCIMRepresentationAttributeValueLst.*
	,SCIMSchemaAttributeModel.*
FROM [SCIM].[dbo].[SCIMRepresentationLst]
	inner join RepresentationAttribute on [SCIMRepresentationLst].Id = RepresentationAttribute.RepresentationId
	inner join SCIMSchemaAttributeModel on RepresentationAttribute.SchemaAttributeId = SCIMSchemaAttributeModel.Id
	left outer join SCIMRepresentationAttributeValueLst ON RepresentationAttribute.Id = SCIMRepresentationAttributeValueLst.SCIMRepresentationAttributeId

This might not mean much for the .NET side of things, but might be useful for further processing on the SQL side. Also if this fouls something on the .NET side of things just close as wont implement as this is not that important

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions