protected override bool IsInputKey(Keys keyData)
{
if (keyData == Keys.Left || keyData == Keys.Right || keyData == Keys.Up)
{
return true;
}
else
{
return base.IsInputKey(keyData);
}
}
Некоторые клавиши, такие как клавиши TAB, RETURN, ESC и клавиши со стрелками, обрабатываются элементами управления автоматически. Чтобы эти ключи вызвали событие KeyDown , необходимо переопределить метод IsInputKey в каждом элементе управления в вашей форме. Код для переопределения IsInputKey должен будет определить, нажата ли одна из специальных клавиш, и вернуть значение true. Вместо переопределения метода IsInputKey , вы можете обрабатывать PreviewKeyDown событие и установите для свойства IsInputKey значение true.
var people = db.people.Where(p =>
p.family.Contains(term)
|| p.name.Contains(term)
|| p.patronymic.Contains(term)
|| p.date_of_birth.ToString().Contains(term)
|| p.telephone.Contains(term)
...
)
.Select(...);
return Json(people, JsonRequestBehavior.AllowGet);
// GET api/values
public async Task<IEnumerable<string>> Get()
{
//Warning bad code
//Context is present here. So you will get data.
var httpContext = HttpContext.Current;
httpContext.Request;
httpContext.User;
httpContext.Response;
httpContext.AllErrors;
httpContext.Session;
await DoSomethingAsync().ConfigureAwait(false); //Will drop Context here.
//Context is null here.
httpContext = HttpContext.Current;
return new List<string>();
}
When the task resumes, it first enters the captured context before executing the remainder of the code.
return await Task.FromResult<string>("Success")
ничего не происходит
Стоит ли мне накатывать миграцию из-за изменения DTO