var entityType = item.GetEntityType(); // 获取到对象类型 var generic = typeof(IRepository<,>).MakeGenericType(entityType, typeof(string));