2025-04-21 09:54:34 +08:00
|
|
|
|
using JiShe.CollectBus.Cassandra;
|
2025-04-15 17:57:47 +08:00
|
|
|
|
using Volo.Abp;
|
|
|
|
|
|
using Volo.Abp.Modularity;
|
|
|
|
|
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class ApplicationInitializationContextExtensions
|
|
|
|
|
|
{
|
2025-04-16 16:12:38 +08:00
|
|
|
|
public static async Task UseCassandra(this ApplicationInitializationContext context)
|
2025-04-15 17:57:47 +08:00
|
|
|
|
{
|
|
|
|
|
|
var service = context.ServiceProvider;
|
|
|
|
|
|
var cassandraProvider = service.GetRequiredService<ICassandraProvider>();
|
2025-04-16 16:12:38 +08:00
|
|
|
|
await cassandraProvider.InitClusterAndSessionAsync();
|
2025-04-15 17:57:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class ServiceCollectionExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void AddCassandra(this ServiceConfigurationContext context)
|
|
|
|
|
|
{
|
2025-04-16 16:12:38 +08:00
|
|
|
|
context.Services.AddTransient(typeof(ICassandraRepository<,>), typeof(CassandraRepository<,>));
|
2025-04-15 17:57:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|