public async Task <GetUserResult> GetUserAsync(string id) { Guid guid; if (Guid.TryParse(id, out guid)) { var query = new GetUserQuery(guid); var handler = _queries.Build(query); return(await handler.GetAsync()); } else { return(new GetUserResult { IsSuccess = false, Message = "Invalid id." }); } }
public Person FindSingle(long Id) { using (IDbConnection db = Connection) { string sql = QueryFactory.Build(QueryTemplateOption.FindSingle, TableMap); Person result = db.QueryFirstOrDefault <Person>(sql, new Person() { Id = Id }); return(result); } }