public SCIMRepresentationBuilder AddComplexAttribute(string name, string schemaId, Action <SCIMRepresentationAttributeBuilder> callback) { var id = Guid.NewGuid().ToString(); var schema = _schemas.First(s => s.Id == schemaId); var schemaAttribute = schema.Attributes.FirstOrDefault(a => a.Name == name); var builder = new SCIMRepresentationAttributeBuilder(id, schema, schemaAttribute); callback(builder); var newAttribute = new SCIMRepresentationAttribute(id, Guid.NewGuid().ToString(), schemaAttribute, schemaId); foreach (var subAttribute in builder.Build()) { _representation.AddAttribute(subAttribute); } _attributes.Add(newAttribute); return(this); }
public SCIMRepresentationAttributeBuilder AddComplexAttribute(string name, Action <SCIMRepresentationAttributeBuilder> callback) { var schemaAttribute = _schema.GetChildren(_scimSchemaAttribute).FirstOrDefault(a => a.Name == name); var id = Guid.NewGuid().ToString(); var attributeId = Guid.NewGuid().ToString(); _attributes.Add(new SCIMRepresentationAttribute(id, attributeId, schemaAttribute, schemaAttribute.SchemaId, valueInteger: 0) { ParentAttributeId = _parentId }); var builder = new SCIMRepresentationAttributeBuilder(id, _schema, schemaAttribute); callback(builder); foreach (var newAttr in builder.Build()) { _attributes.Add(newAttr); } return(this); }