我正在使用dotnet core。我正在尝试实现存储库pastern。
我的解决方案按以下方式设置
class library
在我的存储库项目中,我尝试使用Mongo进行所有用户调用。由于class library
项目没有像web-project startup.cs
这样的入口点。
我的问题是如何将IMongoClient
连接字符串注入存储库类
对于我的Di我正在使用Structruremap
例如
public class UserRepo
{
private readonly IMongoClient _client;
UserRepo(IMongClient client)
{
_client = client;
}
}