问题描述
我正在.net核心Web api项目中使用Entityframeworkcore和Repository模式。
我正在像这样在startup.cs文件中注入(Dependency Injection)IRespository
services.AddTransient<IRespository<Someclass>,SomeRepository>();
public interface IRespository<T> where T : class
{
Task<T> Get(string id);
Task<int> Add(T company);
Task<int> Update(T company);
}
我想知道哪种是最好的(单身,过境或有范围的)?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)