Browse Source

Add service inject

master
Savorboard 5 years ago
parent
commit
5b3f5c2c87
2 changed files with 4 additions and 0 deletions
  1. +2
    -0
      src/DotNetCore.CAP.MySql/CAP.MySqlCapOptionsExtension.cs
  2. +2
    -0
      src/DotNetCore.CAP.RabbitMQ/CAP.RabbitMQCapOptionsExtension.cs

+ 2
- 0
src/DotNetCore.CAP.MySql/CAP.MySqlCapOptionsExtension.cs View File

@@ -22,6 +22,8 @@ namespace DotNetCore.CAP
public void AddServices(IServiceCollection services) public void AddServices(IServiceCollection services)
{ {
services.AddSingleton<CapStorageMarkerService>(); services.AddSingleton<CapStorageMarkerService>();
services.AddSingleton<IDataStorage, MySqlDataStorage>();
services.AddSingleton<IStorageInitializer, MySqlStorageInitializer>(); services.AddSingleton<IStorageInitializer, MySqlStorageInitializer>();
services.AddTransient<CapTransactionBase, MySqlCapTransaction>(); services.AddTransient<CapTransactionBase, MySqlCapTransaction>();




+ 2
- 0
src/DotNetCore.CAP.RabbitMQ/CAP.RabbitMQCapOptionsExtension.cs View File

@@ -4,6 +4,7 @@
using System; using System;
using DotNetCore.CAP.Internal; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.RabbitMQ; using DotNetCore.CAP.RabbitMQ;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;


// ReSharper disable once CheckNamespace // ReSharper disable once CheckNamespace
@@ -23,6 +24,7 @@ namespace DotNetCore.CAP
services.AddSingleton<CapMessageQueueMakerService>(); services.AddSingleton<CapMessageQueueMakerService>();
services.Configure(_configure); services.Configure(_configure);
services.AddSingleton<ITransport, RabbitMQMessageSender>();
services.AddSingleton<IConsumerClientFactory, RabbitMQConsumerClientFactory>(); services.AddSingleton<IConsumerClientFactory, RabbitMQConsumerClientFactory>();
services.AddSingleton<IConnectionChannelPool, ConnectionChannelPool>(); services.AddSingleton<IConnectionChannelPool, ConnectionChannelPool>();


Loading…
Cancel
Save