• Like
When MEF meets Silverlight
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

When MEF meets Silverlight

  • 2,936 views
Published

Cairo Code Camp 2010

Cairo Code Camp 2010

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,936
On SlideShare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
21
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Senior Software at ITWorxTeaching Assistant and pursing Masters at FCISHaving around 17 MS certsHave a blog at
  • 1- Create the app (SL4)2- Create the UI3- Import a Widget4- Export a Widget5- Compose the container.
  • 1- Add a second widget2- Introduce ImportingMany3- Show Lazy4- ExportMetadata5- Custom exports
  • - Say about the choices (Import/Export combination)- How MEF decides to match Export:ContractNameSharedMetadataContractNameCardinalitySharedRecomposableMetadata
  • Container , that has some catalogs which are places where MEF asks how to find matchesAdd an assembly catalog, built in catalog
  • 1- Refactor Things.Extensions2- Make the Allow Recomposible
  • Not just support features extensibilty, but also as a silverlight application everytimexaps are downloaded you try to cut off download size

Transcript

  • 1. When MEF meets Silverlight
    AmrElsehemy
    amr.elsehemy@me.com
    1
  • 2. Speaker
    TA at Faculty of Information and Computer Science Ain Shams University
    Senior Software Engineer at ITWorx
    MCSD, MCPD + more.
    2
  • 3. What's MEF?
    The Managed Extensibility Framework
    “The Managed Extensibility Framework (MEF) is a new library in .NET 4 / Silverlight 4 for building applications that can be incrementally extended” – mef team
    “An extensible framework for composing applications from a set of loosely-couple parts discovered and evolving at run-time” – mtaulty
    3
  • 4. WhywasMEF built?
    4
    I need A
    Put the D
    Can I have C
    F
    E
    F
    B
    A
    App
    C
    G
    D
    Add B
    G
    Then get me E
  • 5. Why MEF
    For customers
    For you and your team
    Always there, always ready
    In the framework!
    5
  • 6. MEF Basics…
    6
    An Application is built of parts
  • 7. Demo
    Building our thing
    7
  • 8. 3 Magic steps
    Export it
    Import it
    Compose it
    8
  • 9. Export it
    9
    [Export(typeof(IThing))]
    publicclassThing
    {
    }
    IThing
    Export
    9
  • 10. Import it
    10
    publicclassMainPage
    {
    [Import(typeof(IThing))]
    publicIThing thing;
    }
    IThing
    Import
    10
  • 11. Compose it
    11
    publicclassMainPage
    {
    publicMainPage()
    {
    CompositionInitializer.SatisfyImports(this);
    }
    Compose
    11
  • 12. Demo
    Giving more
    12
  • 13. Import it - Metadata
    13
    [ImportMany]
    publicIEnumerable<Lazy<IThing, IThingMetadata>> somethings;
    IThing
    ImportMany
  • 14. Export it - Metadata
    14
    [ExportMetadata("Position", ThingPosition.Left)]
    [Export(typeof(IThing))]
    publicpartialclassThing
    {
    }
    Put me in the left
    IThing
    Export
  • 15. Customize it – Custom exports
    15
    [ThingExport(Position = ThingPosition.Left)]
    publicclassThing
    {}
    Put me in the left
    IThing
    Export
    15
  • 16. Demo
    Exploring the catalogs
    16
  • 17. TypeCatalog
    AssemblyCatalog
    AggregateCatalog
    Compose it – Catalogs
    17
  • 18. Demo
    Trim your apps break up your xaps
    18
  • 19. Recomopose- DeploymentCatalog
    Recomposition is key in Silverlight apps
    Initial download, small in size.
    Download more functionality.
    A special Silverlight catalog DeploymentCatalog.
    Trace changes with IPartImportsSatisfiedNotification
    19
  • 20. MEF here, there, everywhere
    Samples
    20
  • 21. MEF versions
    .NET Framework shipping with Silverlight4
    .NET Framework 4 shipping with VS 2010
    Silverlight 3 & .NET Framework V3.5 SP1
    Source on Codeplex (MSPL)
    21
  • 22. Resources
    silverlight.net
    mef.codeplex.com
    mefcontrib.codeplex.com
    blogs.msdn.com/gblock
    mtaulty.com – He is awesome!
    channel9.msdn.com/tags/learnMEFSL4
    22
  • 23. Questions?
    23
  • 24. Thank you
    24
    • Contacts
    • 25. amr.elsehemy@me.com
    • 26. twitter @amrelsehemy
    • 27. Blog http://amrelsehemy.net