· 9 years ago · Jan 30, 2017, 09:28 AM
1public async Task<Application> GetApplication(int id)
2{
3 return _context.Applications.FirstOrDefault(a => a.Id == id);
4}
5
6public async Task<Application> GetApplication(int id)
7{
8 return await _context.Applications.FirstOrDefaultAsync(a => a.Id == id);
9}
10
11CREATE TABLE `application` (
12 `id` INTEGER NOT NULL,
13 `name` TEXT NOT NULL UNIQUE,
14 `application_id` TEXT NOT NULL UNIQUE,
15 `secret_key` TEXT NOT NULL UNIQUE,
16 PRIMARY KEY(id)
17);
18
19+----+---------+----------------+------------+
20| id | name | application_id | secret_key |
21+----+---------+----------------+------------+
22| 1 | TestApp | app123 | secret123 |
23+----+---------+----------------+------------+
24
25at System.Data.Common.DbDataReader.GetFieldValue[T](Int32 ordinal)
26at System.Data.Common.DbDataReader.GetFieldValueAsync[T](Int32 ordinal, CancellationToken cancellationToken)
27--- End of stack trace from previous location where exception was thrown ---
28at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
29at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)