public ScopeQueryResultResource(QueryResult<ScopeSummary> result, UrlHelper url, ScopeMetaData meta) { if (result == null) throw new ArgumentNullException("result"); if (url == null) throw new ArgumentNullException("url"); if (meta == null) throw new ArgumentNullException("meta"); Data = new ScopeQueryResultResourceData(result, url, meta); var links = new Dictionary<string, object>(); if (meta.SupportsCreate) { links["create"] = new CreateScopeLink(url, meta); }; Links = links; }
public Task<IdentityAdminMetadata> GetMetadataAsync() { var updateClient = new List<PropertyMetadata>(); updateClient.AddRange(PropertyMetadata.FromType<Data.StoredClient>()); var createClient = new List<PropertyMetadata> { PropertyMetadata.FromProperty<Data.StoredClient>(x => x.ClientName,"ClientName", required: true), PropertyMetadata.FromProperty<Data.StoredClient>(x => x.ClientId,"ClientId", required: true), }; var client = new ClientMetaData { SupportsCreate = true, SupportsDelete = true, CreateProperties = createClient, UpdateProperties = updateClient }; var updateScope = new List<PropertyMetadata>(); updateScope.AddRange(PropertyMetadata.FromType<Data.StoredScope>()); var createScope = new List<PropertyMetadata> { PropertyMetadata.FromProperty<Data.StoredScope>(x => x.Name,"ScopeName", required: true), }; var scope = new ScopeMetaData { SupportsCreate = true, SupportsDelete = true, CreateProperties = createScope, UpdateProperties = updateScope }; var identityAdminMetadata = new IdentityAdminMetadata { ClientMetaData = client, ScopeMetaData = scope }; return Task.FromResult(identityAdminMetadata); }
private IdentityAdminMetadata GetMetadata() { if (_metadata == null) { var updateClient = new List<PropertyMetadata>(); updateClient.AddRange(PropertyMetadata.FromType<InMemoryClient>()); var createClient = new List<PropertyMetadata> { PropertyMetadata.FromProperty<InMemoryClient>(x => x.ClientName, "ClientName", required: true), PropertyMetadata.FromProperty<InMemoryClient>(x => x.ClientId, "ClientId", required: true), }; var client = new ClientMetaData { SupportsCreate = true, SupportsDelete = true, CreateProperties = createClient, UpdateProperties = updateClient }; var updateScope = new List<PropertyMetadata>(); updateScope.AddRange(PropertyMetadata.FromType<InMemoryScope>()); var createScope = new List<PropertyMetadata> { PropertyMetadata.FromProperty<InMemoryScope>(x => x.Name, "ScopeName", required: true), }; var scope = new ScopeMetaData { SupportsCreate = true, SupportsDelete = true, CreateProperties = createScope, UpdateProperties = updateScope }; _metadata = new IdentityAdminMetadata { ClientMetaData = client, ScopeMetaData = scope }; } return _metadata; }