ServiceDescriptor ServiceDescriptor=services. FirstOrDefault (s=& gt; Typeof (ISqlSugarClient)==s.S erviceType);
SqlSugarClient SqlSugarClient=null;
if (null !=serviceDescriptor) sqlSugarClient=serviceDescriptor. ImplementationFactory. Invoke (services) BuildServiceProvider ()) as sqlSugarClient;
//registered SqlSugar client
Services. AddScoped
If (null==sqlSugarClient) sqlSugarClient=new sqlSugarClient (configs. ToList ());
The else Array. ForEach (configs, config=& gt; SqlSugarClient. AddConnection (config));
BuildAction? Invoke (sqlSugarClient);
Return sqlSugarClient;
});
//registered non-generic storage
Services. AddScoped
//registered SqlSugar storage
Services. AddScoped (typeof (ISqlSugarRepository<>) The typeof (SqlSugarRepository<>) );
Return services;
}