예제 #1
0
        public static SCIMSchemaAttribute ToDomain(this SCIMSchemaAttributeModel schemaAttribute)
        {
            var result = new SCIMSchemaAttribute(schemaAttribute.Id)
            {
                CanonicalValues    = schemaAttribute.CanonicalValues.ToList(),
                CaseExact          = schemaAttribute.CaseExact,
                DefaultValueInt    = schemaAttribute.DefaultValueInt.ToList(),
                DefaultValueString = schemaAttribute.DefaultValueString.ToList(),
                Description        = schemaAttribute.Description,
                MultiValued        = schemaAttribute.MultiValued,
                Mutability         = schemaAttribute.Mutability,
                Name           = schemaAttribute.Name,
                ReferenceTypes = schemaAttribute.ReferenceTypes.ToList(),
                Required       = schemaAttribute.Required,
                Returned       = schemaAttribute.Returned,
                Type           = schemaAttribute.Type,
                Uniqueness     = schemaAttribute.Uniqueness
            };

            if (schemaAttribute.SubAttributes != null && schemaAttribute.SubAttributes.Any())
            {
                foreach (var subAttr in schemaAttribute.SubAttributes.ToList())
                {
                    result.AddSubAttribute(ToDomain(subAttr));
                }
            }

            return(result);
        }
예제 #2
0
        public static SCIMSchemaAttributeModel ToModel(this SCIMSchemaAttribute schemaAttribute, string schemaId)
        {
            var result = new SCIMSchemaAttributeModel
            {
                Id                 = schemaAttribute.Id,
                SchemaId           = schemaId,
                CanonicalValues    = schemaAttribute.CanonicalValues == null ? new List <string>() : schemaAttribute.CanonicalValues.ToList(),
                CaseExact          = schemaAttribute.CaseExact,
                DefaultValueInt    = schemaAttribute.DefaultValueInt.ToList(),
                DefaultValueString = schemaAttribute.DefaultValueString.ToList(),
                Description        = schemaAttribute.Description,
                MultiValued        = schemaAttribute.MultiValued,
                Mutability         = schemaAttribute.Mutability,
                Name               = schemaAttribute.Name,
                ReferenceTypes     = schemaAttribute.ReferenceTypes.ToList(),
                Required           = schemaAttribute.Required,
                Returned           = schemaAttribute.Returned,
                Type               = schemaAttribute.Type,
                Uniqueness         = schemaAttribute.Uniqueness,
                SubAttributes      = new List <SCIMSchemaAttributeModel>()
            };

            if (schemaAttribute.SubAttributes.Any())
            {
                foreach (var subAttr in schemaAttribute.SubAttributes.ToList())
                {
                    result.SubAttributes.Add(ToModel(subAttr, schemaId));
                }
            }

            return(result);
        }