Learn.VideoAnalysis/VideoAnalysisCore/Common/Repository.cs

25 lines
604 B
C#

using SqlSugar;
using SqlSugar.IOC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VideoAnalysisCore.Interface;
using VideoAnalysisCore.Model;
namespace VideoAnalysisCore.Common
{
public class Repository<T> : SimpleClient<T> where T : class, new()
{
public Repository()
{
if(typeof(T).GetInterfaces().Contains(typeof(IKnowsDB)))
base.Context = DbScoped.SugarScope.GetConnection(1001);
else
base.Context = DbScoped.SugarScope;
}
}
}