Quantcast
Channel: Managed Extensibility Framework
Viewing all articles
Browse latest Browse all 265

New Post: Resolving Open Generics with RegistrationBuilder

$
0
0

My open generic works fine when exported with an attribute, such as

 

 

[Export(typeof(IRepository

<>))] 

 

publicclassExampleRepository<T> : IRepository<T>whereT : class

 

 However, I haven't been able to work out how to export this with RegistrationBuilder. Neither of these work

 

builder.ForTypesDerivedFrom(typeof(IRepository<>)).ExportInterfaces();

builder.ForTypesDerivedFrom(typeof(IRepository<>)).Export(eb => eb.AsContractType(typeof(IRepository

 <>)));

Has anyone worked out how to export open generics from RegistrationBuilder?

Is it impossible?

 

 

 

 

 


Viewing all articles
Browse latest Browse all 265

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>