@@ -10,7 +10,7 @@ namespace SimpleIdServer.Scim.Persistence.EF.Extensions
1010{
1111 public static class MappingExtensions
1212 {
13- public static SCIMRepresentationAttributeModel ToModel ( this SCIMRepresentationAttribute a )
13+ public static SCIMRepresentationAttributeModel ToModel ( this SCIMRepresentationAttribute a , string representationId )
1414 {
1515 var values = new List < SCIMRepresentationAttributeValueModel > ( ) ;
1616 values . AddRange ( a . ValuesBoolean . Select ( b => new SCIMRepresentationAttributeValueModel
@@ -42,6 +42,7 @@ public static SCIMRepresentationAttributeModel ToModel(this SCIMRepresentationAt
4242 {
4343 Id = a . Id ,
4444 Values = values ,
45+ RepresentationId = representationId ,
4546 ParentId = a . Parent == null ? null : a . Parent . Id ,
4647 SchemaAttributeId = a . SchemaAttribute . Id ,
4748 Children = new List < SCIMRepresentationAttributeModel > ( )
@@ -51,7 +52,7 @@ public static SCIMRepresentationAttributeModel ToModel(this SCIMRepresentationAt
5152 {
5253 foreach ( var r in a . Values )
5354 {
54- result . Children . Add ( ToModel ( r ) ) ;
55+ result . Children . Add ( ToModel ( r , representationId ) ) ;
5556 }
5657 }
5758
@@ -73,16 +74,17 @@ public static SCIMSchemaModel ToModel(this SCIMSchema schema)
7374 Required = s . Required ,
7475 Schema = s . Schema
7576 } ) . ToList ( ) ,
76- Attributes = schema . Attributes . Select ( s => ToModel ( s ) ) . ToList ( )
77+ Attributes = schema . Attributes . Select ( s => ToModel ( s , schema . Id ) ) . ToList ( )
7778 } ;
7879 return result ;
7980 }
8081
81- public static SCIMSchemaAttributeModel ToModel ( this SCIMSchemaAttribute schemaAttribute )
82+ public static SCIMSchemaAttributeModel ToModel ( this SCIMSchemaAttribute schemaAttribute , string schemaId )
8283 {
8384 var result = new SCIMSchemaAttributeModel
8485 {
8586 Id = schemaAttribute . Id ,
87+ SchemaId = schemaId ,
8688 CanonicalValues = schemaAttribute . CanonicalValues . ToList ( ) ,
8789 CaseExact = schemaAttribute . CaseExact ,
8890 DefaultValueInt = schemaAttribute . DefaultValueInt . ToList ( ) ,
@@ -103,7 +105,7 @@ public static SCIMSchemaAttributeModel ToModel(this SCIMSchemaAttribute schemaAt
103105 {
104106 foreach ( var subAttr in schemaAttribute . SubAttributes . ToList ( ) )
105107 {
106- result . SubAttributes . Add ( ToModel ( subAttr ) ) ;
108+ result . SubAttributes . Add ( ToModel ( subAttr , schemaId ) ) ;
107109 }
108110 }
109111
0 commit comments