Experiment: Building an AppMarket using The MEF and .NET 4 Josh Twist Principal Consultant, Microsoft UK www.thejoyofcode.com [email protected] @joshtwist
Jan 05, 2016
Experiment: Building an AppMarket using The MEF and .NET 4
Experiment: Building an AppMarket using The MEF and .NET 4Josh TwistPrincipal Consultant, Microsoft UK
www.thejoyofcode.com [email protected]@joshtwist
About this sessionFocus is The MEFNot aiming to cover all the features but apply it to a scenarioHeaps to get through so need some Blue Peter ingredients
The experimentBuild an extensible application that can download and run applets.Allow the applets to leverage optional servicesCreate a service that makes applets discoverable with the minimum amount of codePrimersDependency Injection (DI) and Inversion of Control (IoC) ContainersThe Managed Extensibility FrameworkDI/IoC ContainersAbout the removal of concrete dependencies
Using abstract types (ideally interfaces)
The Container is the FooMaker
Most containers are typically configured via code or XML
Foo foo = new Foo();IFoo foo = FooMaker.GetFoo();IFoo foo = Container.Resolve();Container.RegisterType();
DI/IoC ContainersType are registered in a catalog(ue)
But, what if Foo depends on IBar?
FromToFabricam.Contracts.IFooFabricam.Fubar.FooFabricam.Contracts.IBarFabricam.Fubar.BarFabricam.Common.ILoggerContoso.Log4NetLoggerFabricam.AppMarket.IAppletContoso.Fakebook//constructorpublic Foo(IBar bar)The MEFVery similar, it has A containerCatalogsStrategic build up of dependencies
But the focus is different
Its all about runtime discovery baby!Experiment: the ShellHome{Binding HomeCommand}{Binding Applets}{Binding LaunchCommand}{Binding CurrentApplet}Whats this?
Power Station
10Whats this?
Plug
Whats this?
Kettle
Let the DEMO beginAt last, some codeA lot of things to think aboutVersioning (both the contracts and the applets)Security (regrettably mostly overlooked in this session)Memory managementThank [email protected]@joshtwistwww.thejoyofcode.com