/// <summary>
        /// 添加仓储合集
        /// </summary>
        /// <param name="services"></param>
        public static void AddRepositories <TDbContext>(this IServiceCollection services)
            where TDbContext : DbContext
        {
            // 所有对baseEntity的实现
            var typeList = EntityTypeFinder.FindEntityTypes(typeof(TDbContext));

            // 循环注入
            foreach (var type in typeList)
            {
                var genericType = type.GetBaseGenericArguments().FirstOrDefault();

                // IRepository 的类型
                var interfaceRepository = typeof(IRepository <,>).MakeGenericType(type, genericType);

                // BaseRepository 的类型
                var repository = typeof(BaseRepository <, ,>).MakeGenericType(type, genericType, typeof(TDbContext));
                services.AddScoped(interfaceRepository, repository);
            }

            // 工作单元
            services.AddScoped <IUnitOfWork <TDbContext>, UnitOfWork <TDbContext> >();
        }