using AspectCore.Configuration;
using AspectCore.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Data;
using System.Linq;
using System.Reflection;
namespace XYY.Core.Standard.Data.Infrastructure
{
public static class AddDBEx
{
///
/// 数据服务注册
///
///
///
public static void AddDB(this IServiceCollection services, string connection)
{
Console.WriteLine("数据服务注册" );
services.AddScoped(x => new UnitOfWork(ConnectionHelper.BuildDbConnection(connection), connection));
//AddTransactionProcessing(services);
}
public static void ConfigAspectCore(this IServiceCollection services, string serviceEndName)
{
services.ConfigureDynamicProxy(config =>
{
config.Interceptors.AddTyped(
Predicates.ForService("*" + serviceEndName + "*"));
}
); ;
}
}
}