Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationConfiguration"/> class.
 /// </summary>
 /// <param name="secrets">The secrets.</param>
 /// <param name="commands">The commands.</param>
 public ApplicationConfiguration(
     ISecretConfiguration secrets,
     ICommandConfiguration commands)
 {
     Secrets  = secrets;
     Commands = commands;
 }
Exemple #2
0
        /// <summary>
        /// Registers the database context.
        /// </summary>
        /// <param name="services">The services.</param>
        /// <returns>
        /// The same service collection that is passed as an argument
        /// so that it can be used in further configuration chain.
        /// </returns>
        public static IServiceCollection AddDbContext(this IServiceCollection services)
        {
            return(services.AddDbContext <SchedulerBotContext>((provider, builder) =>
            {
                ISecretConfiguration secretConfiguration = provider.GetRequiredService <ISecretConfiguration>();
                string connectionString = secretConfiguration.ConnectionString;

                builder.UseSqlServer(connectionString);
            }));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationConfiguration"/> class.
 /// </summary>
 /// <param name="secrets">The secrets.</param>
 public ApplicationConfiguration(
     ISecretConfiguration secrets)
 {
     Secrets = secrets;
 }