小编Arg*_*gon的帖子

DeprecationWarning:一个布尔值被传递给 options.operatorsAliases。这是 v5 的无操作,应删除

我在使用 Sequelize 的 expressJs 上遇到以下错误

DeprecationWarning: A boolean value was passed to options.operatorsAliases. This is a no-op with v5 and should be removed.
Run Code Online (Sandbox Code Playgroud)

有什么想法可以解决这个问题吗?

mysql express sequelize.js

24
推荐指数
3
解决办法
2万
查看次数

从在异步方法内启动的while循环退出

如何打破异步方法内部的while循环。请参考下面的代码

我尝试了很多方法,但没有一个对我有用

async void TotalTimer(string time)
{
    while (true)
    {
        TimeSpan timesp = DateTime.Now - DateTime.Parse(time);
        TotalTime = timesp.Hours + " : " + timesp.Minutes + " : " + timesp.Seconds;
        await Task.Delay(1000);

        if (string.IsNullOrEmpty(time))
        {
            break;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我需要停止并退出循环


更新的代码:

async Task TotalTimer(CancellationToken token)
{
    var intime = await App.Database.GetRecentIn();
    InTime = DateTime.Parse(intime.datetime).ToString("hh:mm tt");


    while (!token.IsCancellationRequested)
    {
        TimeSpan timesp = DateTime.Now - DateTime.Parse(intime.datetime);
        TotalTime = timesp.Hours + " : " + timesp.Minutes + " : " + timesp.Seconds; …
Run Code Online (Sandbox Code Playgroud)

c# asynchronous while-loop

1
推荐指数
1
解决办法
145
查看次数

标签 统计

asynchronous ×1

c# ×1

express ×1

mysql ×1

sequelize.js ×1

while-loop ×1