Programming Tips on 01-04-2020

  1. safely convert Unix TimeStamp to string :
    DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture.NumberFormat)
    

    source

  2. DI with parameters in constructor
    services.AddScoped<SmsSentLogRepo>(s => new SmsSentLogRepo(Configuration.GetConnectionString("sms")));
    
  3. You should use ConfigureAwait(false) in your library code. source