Note that there are some explanatory texts on larger screens.

plurals
  1. POAutofac - None of the constructors found with 'Public binding flags'
    primarykey
    data
    text
    <p>I keep on getting an error when trying to resolve my repositories.</p> <p>None of the constructors found with 'Public binding flags' on type can be invoked with the available services and parameters: Cannot resolve parameter 'Repository.Data.INHibernateSession nHibernateSession' of constructor 'Void .ctor(Repository.Data.INHibernateSession)'.</p> <p>Global.asax</p> <pre><code>builder.RegisterAssemblyTypes(assembly).Where(t =&gt; typeof(IDependency).IsAssignableFrom(t)). AsImplementedInterfaces().InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(assembly).Where(t =&gt; typeof(ISingletonDependency).IsAssignableFrom(t)). AsImplementedInterfaces().SingleInstance(); builder.RegisterAssemblyTypes(assembly).Where(t =&gt; typeof(ITransientDependency).IsAssignableFrom(t)). AsImplementedInterfaces().InstancePerDependency(); builder.RegisterGeneric(typeof(Repository&lt;&gt;)).As(typeof(IRepository&lt;&gt;)).InstancePerDependency(); </code></pre> <p>then i have my singleton factory</p> <pre><code>public interface INhibernateFactory : ISingletonDependency { ISessionFactory SessionFactory { get; } } </code></pre> <p>then my instance per lifetime</p> <pre><code>public interface INHibernateSession : IDependency { ISession Session { get; } } public class NHibernateSession : IDependency { private ISession _session; private readonly ISessionFactory _sessionFactory; public NHibernateSession(ISessionFactory sessionFactory) { _sessionFactory = sessionFactory; } </code></pre> <p>then in my Generic repository</p> <pre><code>public class Repository&lt;T&gt; : IRepository&lt;T&gt; where T : class { private readonly INHibernateSession _nHibernateSession; public Repository(INHibernateSession nHibernateSession) { _nHibernateSession = nHibernateSession; } public ISession Session { get { return _nHibernateSession.Session; } } </code></pre> <p>It seems all i'm doing is creating a singleton, inject that to the session, then inject into repository. (all my other dependencies work fine)</p> <p>Appreciate if someone could point me in the right direction why this wont resolve, I'm quite stumped?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload