[英]Not Implemented Exception while using Insight.Database micro ORM
每當我嘗試在CustomerRepository中調用InsertCustomer方法時,我都會嘗試使用出色的Insight.Database微型ORM並遇到一個Not Implemeneted異常。
更新:我確保方法名稱與sql server存儲過程名稱匹配
public class CustomerRepository
{
private ICustomerRepository _repo;
public static async Task<int> InsertCustomer(Customer cust)
{
var _repo = ConfigSettings.CustomerRepository;
return await _repo.InsertCustomer(cust);
}
}
public class ConfigSettings
{
private static ICustomerRepository _customerRepository;
public static ICustomerRepository CustomerRepository
{
get
{
if (_customerRepository == null)
{
_customerRepository = new SqlConnection(ConfigurationManager.ConnectionStrings["CustomerService_Conn_String"].ConnectionString).AsParallel<ICustomerRepository>();
}
return _customerRepository;
}
}
}
[Sql(Schema="dbo")]
public interface ICustomerRepository
{
[Sql("dbo.InsertCustomer")]
Task<int> InsertCustomer(Customer cust);
}
如果您收到NotImplementedException,並運行v4.1.0至4.1.3,則可能是在注冊數據庫提供程序時遇到了問題。
我建議使用v4.1.4或更高版本,並確保您為數據庫注冊了提供程序。
看到
https://github.com/jonwagner/Insight.Database/wiki/Installing-Insight
如果您還有其他問題,可以在github上發布問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.