Pregunta

I was trying to use the cool Insight.Database micro ORM and run into a Not Implemeneted exception everytime I try to invoke the InsertCustomer method in the CustomerRepository.Any help would be appreciated

Update: I made sure that the method name matches the sql server stored procedure name

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);
    }
¿Fue útil?

Solución

If you're getting a NotImplementedException, and running v4.1.0 to 4.1.3 you're probably running into a problem registering your database provider.

I recommend using v4.1.4 or later and making sure you register the provider for your database.

See

https://github.com/jonwagner/Insight.Database/wiki/Installing-Insight

If you have any more problems, you can post an issue on github.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top