Comments (4)
To start off, I'll call out that the caching feature is a proof of concept in its current form. I wouldn't recommend shipping an app that relies on it just yet. We are actively working on finishing that feature though, so I hope soon we can freely encourage people to try it out and ship with it.
To your questions:
- In VS MEF we just have
ComposableCatalog
. You can add parts to an existing one and merge catalogs together. You can use thePartDiscovery
-derived class to scan entire assemblies and add the resulting parts to a catalog, and you can loop over all the assemblies in a directory and do the same thing. ExportFactory<T>
works great in VS MEF. Having an[ImportMany]
attribute on it I believe wouldn't be used to "create many instances of an exported part" however, since a singleExportFactory<T>
does just that. Rather, if you have[ImportMany]
on anList<ExportFactory<T>>
what you get is oneExportFactory<T>
for each unique export ofT
. You could use this collection of factories to create instances of many different parts.- Yes,
LoadDefault()
loads an existing cache. The way theAppHost
package works is it leads your project to construct this cache at build-time. The idea is you ship the cache with your application so that it's always present. However this design doesn't leave your app extensible after you've built it. Our readme goes over this and how to write an extensible app if that's what you need. Visual Studio itself demonstrates that VS MEF can be used to create an extensible app with caching, but there's a great deal of cache handling code in VS itself that is not part of the VS MEF library. I hope we can bring more of that into the VS MEF library in the future. - I don't know of one off hand outside our own unit tests and documentation. So I just created one for you to look at.
from vs-mef.
I wrote up some additional docs, including the topic of DirectoryCatalog
, which you can review here.
from vs-mef.
Thanks for your quick responses and demos. I was able to put together a test project with all the ways we used System.Composition so we're on the way. I'm performance testing right now, so hopefully this will bump the speed up.
If you are interested when I'm done with testing I can post my test project which has your example code and the other elements we use, such as DirectoryCatalog, ImportMany, & ExportFactory.
from vs-mef.
I'd love to hear the results of your effort and perf testing.
Without the cache, I expect your startup time to perhaps go down since VS MEF front-loads composition while MEFv2 you pay for it repeatedly in throughput perf. With the cache (which is getting closer every week) I expect VS MEF to be faster than MEFv1 and MEFv2 in (nearly?) every metric.
from vs-mef.
Related Issues (20)
- GC pressure in CompositionConfiguration even when loading from cache HOT 6
- Consider adding AllowRejection to formalize rejection HOT 5
- Types containing naked type parameters as elements in a base class incorrectly fail discovery HOT 2
- Consider adding a test helper library
- Publish Updated NuGet Package HOT 1
- CompositionFailedException is not serializable
- LazyMetadataWrapper not super performant HOT 2
- Composition Analyzer package does not install when using packages.config HOT 2
- Install of latest alpha 16.9.6 fails for .NET-Framework 4.7.2 HOT 1
- Analyzers assembly needs to increment version in every NuGet package
- Lots of (most likely duplicate) assemblyname instances HOT 4
- Analyzer could detect duplicate imports HOT 2
- RuntimePartLifecycleTracker.CreateValue picks wrong ImportingConstructor with generic type argument in signature
- Add analyzer to detect when a class has more than one `ImportingConstructor` attribute HOT 1
- Analyzer to ensure correct C# nullable annotation when AllowDefault = true HOT 1
- Allow C# records to be used as metadata views HOT 1
- Equivalent SatisfyImportsOnce HOT 3
- Expose assembly name that provides exported part HOT 4
- StandardAssemblyLoader.LoadAssembly does not respect codeBasePath on .NET Core HOT 2
- Support generic imports (GenericHost/Options DI) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vs-mef.