namespace BBM.ChatGLM.FreeSqlRepository;

public class ChatGLMFreeSqlModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var configuration = context.Services.GetConfiguration();
        var connectionString = configuration.GetConnectionString("Default");
        var freeSql = new FreeSql.FreeSqlBuilder()
            .UseConnectionString(FreeSql.DataType.PostgreSQL, connectionString)
            .UseMonitorCommand(cmd => Console.WriteLine(cmd.CommandText))
            .Build();
        
        context.Services.AddSingleton<IFreeSql>(freeSql);
    }
}