Tech·Ed North America /10/2018 2:43 PM

Slides:



Advertisements
Similar presentations
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Multitenant Model Request/Response General Model.
Announcing Demo Announcing.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Receive Inventory Export Parse and Normalize.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
announcing Dev Manager Do I understand what we’ve built? Developer Can I bet on using this shared component? Testers What’s changed since I last.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
Bart J.F. De Smet Software Development Engineer Microsoft Corporation Session Code: DTL315.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Sara Ford Program Manager Microsoft Corporation DPR301.

Scott Morrison Program Manager Microsoft Corporation Session Code: WUX308.
MIX 09 4/17/2018 4:41 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
6/26/2018 9:02 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
9/11/2018 5:53 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Tech·Ed North America /14/2018 7:13 PM
Возможности Excel 2010, о которых следует знать
Sysinternals Tutorials
Tech·Ed North America /18/ :26 AM
Tech·Ed North America /19/ :44 PM
Title of Presentation 11/22/2018 3:34 PM
What’s New In ASP.NET MVC 2
Jason Zander Unplugged
Title of Presentation 12/2/2018 3:48 PM
12/5/2018 3:24 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Tech·Ed North America /7/2018 2:51 PM
12/27/ :01 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Authoring for Microsoft Silverlight 4 with Microsoft Expression Blend
Data Driven ASP.NET Web Forms Applications Deep Dive
Tech·Ed North America /2/2019 4:47 PM
Tech·Ed North America /17/2019 1:47 AM
1/17/2019 9:05 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Tech·Ed North America /17/2019 6:01 PM
Peter Provost Sr. Program Manager Microsoft Session Code: DEV312
Tech·Ed North America /22/2019 7:40 PM
Building Silverlight Apps with RIA Services
Using Windows Runtime and SDK to build Metro style apps
Silverlight Debugging
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows 8 Security Internals
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
2010 Microsoft BI Conference
Tech·Ed North America /25/ :53 PM
Hack-proofing your Clients using Windows 7 Security!
How and When to Use MEF: Too Much Is Never Enough
Leveraging existing code in Metro style apps
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
Lap Around the Windows Azure Platform
Code First Development in Microsoft ADO.NET Entity Framework 4.1
Title of Presentation 5/24/2019 1:26 PM
Title of Presentation 7/24/2019 8:53 PM
Tech·Ed North America /17/2019 4:14 PM
WCL425 App Compat for Nerds Chris Jackson.
Presentation transcript:

Tech·Ed North America 2009 11/10/2018 2:43 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Managed Extensibility Framework Tech·Ed  North America 2009 11/10/2018 2:43 PM Managed Extensibility Framework Jason “For The Developers” Olson jason.olson@microsoft.com http://www.managed-world.com http://www.twitter.com/jolson © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

From The 1967 World’s Fair (most successful fair ever, attracting over 50 million visitors) -------------- Expo 67 was nicknamed "Man and his World", taken from Antoine de Saint Exupéry's memoir Terre des hommes, (literally "Land of Men"), translated as Wind, Sand and Stars. Housing was one of the main themes of Expo 67. Habitat 67 then became a thematic pavilion visited by thousands of visitors who came from around the world. During Expo 67 it was also the temporary residence of the many dignitaries coming to Montreal. It was designed to integrate the variety and diversity of scattered private homes with the economics and density of a modern apartment building. Modular, interlocking concrete forms define the space. The project was designed to create affordable housing with close but private quarters, each equipped with a garden. The building was believed to illustrate the new lifestyle people would live in increasingly crowded cities around the world.[1] The complex was originally meant to be vastly larger. Ironically, the building's units are now quite expensive from demand rather than "affordable" due to its architectural cachet. It is owned by its tenants who formed a limited partnership that purchased the building from the Canada Mortgage and Housing Corporation in 1985.

Objectives Understand importance of Extensibility to software Understand when MEF would be used Understand how MEF is used

The Problem… Software Maintenance Original Software Development Nearly 80% of software development costs is in the maintenance of software. Original Software Development

Managed Extensibility Framework? The Managed Extensibility Framework (MEF) is a new library in the .NET Framework that enables greater reuse of applications and components. Using MEF, .NET applications can make the shift from being statically compiled to dynamically composed MESSAGING: New Library = just an assembly, a normal .dll, used by any .NET language Dynamically Composed = composition takes place at runtime and composition behavior differs depending on how it is configured.

com·pose [ kəm pṓz ] 2) To put things together to form a whole MSN Encarta

Open/Closed Principle Software entities should be open for extension, but closed for modification.

Known vs. Unknown MESSAGING: Due to it’s declarative-based and discovery-enabled approach, MEF becomes very powerful to use in an application where it is being used to put together a bunch of potentially unknown parts into a working application. You might also think about this as a 3rd party extending your application. When you are compiling your application (long before you ship), you have absolutely no idea on what sorts of extensions might be built for your application into the future. That’s the power of extensible applications, they can be extended and used in ways the original authors perhaps didn’t expect, or didn’t have the time to do themselves. If you are concerned strictly with the “known” part of the equation (composing different software entities together that are all known at compile time), there are other solutions that are available today that are very powerful for this scenario: namely IoC containers (IoC = Inversion of Control). The Managed Extensibility Framework was designed primarily with the unknown aspect of extension in mind.

Let me know you’re there! send hello How well I’m doing? send is cool or is not cool Sample messages: #dtl328 hello / #dtl328 is cool / #dtl328 is not cool

Twitter – Demo Dashboard 11/10/2018 2:43 PM demo If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Twitter – Demo Dashboard © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

An Application is built of parts. MEF Basics… An Application is built of parts.

MEF Basics… Export it. Import it. Compose it.

Part A Part, enter stage left… public class SimpleMortgageCalculator : IMortgageCalculator { public ILogger Logger { get; set; } public float Calculate() Logger.Log("Calculating Mortgage"); return ...; } Part A MESSAGING: So, if a MEF-aware application is built of parts, parts can be thought of as the “heart” of a MEF-aware application. Let’s take a look at a simple Part. In this case, it is a class called SimpleMortgageCalculator that has one dependency it needs satisfied, an ILogger. Let’s see how we would use MEF to declare the needs this part has in order to be composed.

Part A Export it. Export [Export(typeof(IMortgageCalculator))] public class SimpleMortgageCalculator : IMortgageCalculator { public ILogger Logger { get; set; } public float Calculate() Logger.Log("Calculating Mortgage"); return ...; } Part A MESSAGING: Now in the case of Exports, exports are contracts a part offers to other parts. In the case of our SimpleMortageCalculator, we are exporting ourself as an IMortgageCalculator. This is done very easily by decorating our class with an Export class and specifying that we would like to export ourselves specifically as an IMortgageCalculator (it’s important to note, that if you left out “typeof(IMortgageCalculator)”, the class would be exported as a SimpleMortgageCalculator instead (so other parts importing IMortgageCalculator would not find us)). Once again, very simple. Decorate with an Export attribute and MEF has all the information it needs for this specific part. Export

Part A Import it. Import [Export(typeof(IMortgageCalculator))] public class SimpleMortgageCalculator : IMortgageCalculator { [Import(typeof(ILogger))] public ILogger Logger { get; set; } public float Calculate() Logger.Log("Calculating Mortgage"); return ...; } Part A MESSAGING: In the case of our SimpleMortageCalculator, we simply decorate our ILogger property with an Import attribute that specifies what type we need to import (this is because we could very well be importing a different type of contract than is satisfied directly (see the slide on Lazy for more info)). This is how simple it is. Decorate with an Import attribute and MEF has all the information it needs for this specific part. NOTES: This could also be done on a constructor that accepts an ILogger and uses the ImportingConstructor attribute. Import

Catalogs provide the parts. Compose it. Catalogs provide the parts. Catalog

Container is the matchmaker. Compose it. Container is the matchmaker. Catalog

Container is the matchmaker. Compose it. AggregatingCatalog Container is the matchmaker. DirectoryCatalog Catalog AssemblyCatalog MESSAGING: Now that we’ve declared all our Imports and Exports, how are they all matched up together? This is the job of the container. The container is the “match maker” if you will. An application will ask the configured container for an object of a given type, then the container will take care of building up the entire object graph and returning the necessary object. All of this matching is handled by the container itself, the user doesn’t have to think about it at all. TypeCatalog

demo Step 1 - MEF Basics 11/10/2018 2:43 PM If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Step 1 - MEF Basics © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

The Power of Being Declarative What vs. How Benefits of attribute-based model Taking a step further, what XAML integration opens up

Parts can be lazy… Part A Part B [Import(typeof(ILogger))] public ILogger Logger { get; set; } Part A Part B MESSAGING: Sometimes though, you may not want to import the part itself (let’s say you may only need to use it in specific situations and hence don’t want to create it in every situation, or you might want to programatically determine whether it should be imported or not). This can be done in MEF through lazy imports. To lazily import a part, rather than having the property imported to be the type of the import directly, you can import Export<T> (where T is the type you are importing). Once you have a reference to the Export, you have direct access to information like the contract for that Export as well as any Metadata for that Export (which can then be used to query against to determine whether the import should be used or not).

Parts can be lazy… Part A Export <B> [Import(typeof(ILogger))] public ILogger Export<ILogger> Logger { get; set; } Part A Export <B> MESSAGING: Sometimes though, you may not want to import the part itself (let’s say you may only need to use it in specific situations and hence don’t want to create it in every situation, or you might want to programatically determine whether it should be imported or not). This can be done in MEF through lazy imports. To lazily import a part, rather than having the property imported to be the type of the import directly, you can import Export<T> (where T is the type you are importing). Once you have a reference to the Export, you have direct access to information like the contract for that Export as well as any Metadata for that Export (which can then be used to query against to determine whether the import should be used or not).

demo Step 2 - Lazy Evaluation 11/10/2018 2:43 PM If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Step 2 - Lazy Evaluation © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

The importance of context!

Step 3 – Context-Awareness 11/10/2018 2:43 PM demo If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Step 3 – Context-Awareness © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Lifetime Container Container Shared Non-Shared Part A Part B Part B MESSAGING: MEF also provides parts the capability of specifying what their lifetime behavior should be (like whether one instance of a part should be used everywhere, or whether a new instance should be created for each new request for that part). Among other things, this is enables scenarios like using MEF in a web server scenario or in a scenario where you might require a part to be isolated from other instances of the same part. This can be specified very easily using the PartCreationOptions on either the Import or Export attribute.

demo Step 4 - Lifetime 11/10/2018 2:43 PM If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Step 4 - Lifetime © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

so-called external dependencies? But Jason… Where are the so-called external dependencies?

.\Extensions CompositionContainer

Step 5 – External Dependencies 11/10/2018 2:43 PM demo If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Step 5 – External Dependencies © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

How does this compare to… System.AddIn? IoC Containers? Hand-Rolled Plugin Systems?

Twitter – Demo Dashboard Dissection 11/10/2018 2:43 PM demo If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Twitter – Demo Dashboard Dissection © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

The Problem… Software Maintenance Original Software Development Nearly 80% of software development costs is in the maintenance of software. Original Software Development

Solving The Problem… Original Software Development Software Maintenance Original Software Development Nearly 80% of software development costs is in the maintenance of software.

Resources http://mef.codeplex.com Clean Code, Robert C. Martin Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings at TechEd Online. Resources www.microsoft.com/teched Sessions On-Demand & Community http://mef.codeplex.com Clean Code, Robert C. Martin

Related Content Breakout Sessions Required Slide Speakers, please list the Breakout Sessions, TLC Interactive Theaters and Labs that are related to your session. Related Content Breakout Sessions DTL314 – Understanding Code Extensibility WUX314 – SOLIDify Your ASP.NET MVC Apps DPR204 – Lean Practices, Agile Techniques BOF54 – Agile Development w/ Microsoft .NET

Complete an evaluation on CommNet and enter to win! Required Slide Complete an evaluation on CommNet and enter to win!

Required Slide 11/10/2018 2:43 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.