Hello. I use Autofac Mef integration framework in my windows service project. I define several modules
and bind them when service start. But don't know how I can move my Repository class in separate module.
In my program i define Repository class as generic.
For example
public class Repository<T>: IRepository<T>, IDisposable where T : class
{
.........
}
[InheritedExport]
public interface IRepository<T>
{
....
}
I define InheritedExportAttribute in my interface for export in MEF modules.
But AutofacMef Integration doesn't find default constructor for any class,
which I define in generic class.
Is it possible to use this way at all? thank for help
My error:
Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'SolarRadiationCell.Host.HostService' can be invoked with the available services and parameters:
Cannot resolve parameter 'SolarRadiationCell.Service.Shared.IRepository
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
and bind them when service start. But don't know how I can move my Repository class in separate module.
In my program i define Repository class as generic.
For example
public class Repository<T>: IRepository<T>, IDisposable where T : class
{
.........
}
[InheritedExport]
public interface IRepository<T>
{
....
}
I define InheritedExportAttribute in my interface for export in MEF modules.
But AutofacMef Integration doesn't find default constructor for any class,
which I define in generic class.
Is it possible to use this way at all? thank for help
My error:
Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'SolarRadiationCell.Host.HostService' can be invoked with the available services and parameters:
Cannot resolve parameter 'SolarRadiationCell.Service.Shared.IRepository
1[SolarRadiationCell.Data.History.IHistory] _repository' of constructor 'Void .ctor(SolarRadiationCell.Service.Shared.IRepository
1[SolarRadiationCell.Data.History.IHistory])'.at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)