Closed SalimiHabib closed 4 years ago
Just for the reference, in DryIoc you will register the assemblies via RegisterMany
with the optional argument nonPublicServiceTypes: true
.
@dansiegel Is it translated to the Prism api? I think that maybe not all of the supported IoCs have this option.
base on @dadhi post i try this
` protected override void RegisterTypes(IContainerRegistry containerRegistry) {
containerRegistry.RegisterSingleton<IAppInfo, AppInfoImplementation>();
containerRegistry.RegisterSingleton<IPoolConfigurator, PoolConfigurator>();
containerRegistry.RegisterSingleton<IEdgeClientService, EdgeClientService>();
var implTypes = typeof(IEdgeProvisioningService).GetAssembly().GetTypes() ;
PrismContainerExtension.Current.Instance.RegisterMany(implTypes, nonPublicServiceTypes: true); `
and i got this error on RegisterMany method concrete implementation exist but with internal access modifier and public constructor
DryIoc.ContainerException Message=code: RegisteringAbstractImplementationTypeAndNoFactoryMethod; message: Registering abstract implementation type Hyperledger.Aries.Agents.Edge.IEdgeProvisioningService when it is should be concrete. Also there is not FactoryMethod to use instead.
var implTypes = typeof(IEdgeProvisioningService).GetAssembly().GetTypes()
Filter your implementation types:
var implTypes = typeof(IEdgeProvisioningService).GetAssembly().GetTypes().Where(t => t.IsImplementationType());
Here are all the goodies https://www.fuget.org/packages/DryIoc.dll/4.4.1/lib/netstandard2.0/DryIoc.dll/DryIoc/Registrator, search for IsImplementationType
automatic registration of an assembly isn't something I'm going to do for Prism or the Container Extensions here. However this sort of functionality is something that I'm open to duplicating for the Prism.Magician.
That said the RegisterMany in Prism should pull in any interface that is on a given type if you do not specify any service types.
how can register all types in assembly at once ? my setup is
Also some types are internal with public constructor in that assembly that need to be registered
thank you