using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;

namespace JiShe.CollectBus.Cassandra
{
    [DependsOn(
        typeof(AbpAutofacModule)
    )]
    public class CollectBusCassandraModule : AbpModule
    {
        public override Task ConfigureServicesAsync(ServiceConfigurationContext context)
        {
            Configure<CassandraConfig>(context.Services.GetConfiguration().GetSection("Cassandra"));
            context.AddCassandra();
            return Task.CompletedTask;
        }

        public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
        {
            await context.UseCassandra();
        }
    }
}
