public static async Task <List <FlattenedConsentHandle> > InsertTestData_Consents(string clientId, string subject, int count = 1) { var dao = new IdentityServer3CassandraDao(); await dao.EstablishConnectionAsync(); List <FlattenedConsentHandle> result = new List <FlattenedConsentHandle>(); for (int i = 0; i < count; ++i) { var flat = new FlattenedConsentHandle(new Consent() { ClientId = clientId, Scopes = new List <string>() { "Scope 0:", "Scope 1:" }, Subject = subject }); result.Add(flat); } await dao.CreateManyConsentHandleAsync(result); return(result); }
public async Task <bool> CreateConsentHandleAsync(FlattenedConsentHandle flat, CancellationToken cancellationToken = default(CancellationToken)) { try { MyMappings.Init(); var list = new List <FlattenedConsentHandle> { flat }; return(await CreateManyConsentHandleAsync(list, cancellationToken)); } catch (Exception e) { return(false); } }