Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome to Grigori Melnik’s talk on Microsoft Enterprise Library patterns & practices symposium 2010 Please wait while the Setup Wizard prepares.

Similar presentations


Presentation on theme: "Welcome to Grigori Melnik’s talk on Microsoft Enterprise Library patterns & practices symposium 2010 Please wait while the Setup Wizard prepares."— Presentation transcript:

1 Welcome to Grigori Melnik’s talk on Microsoft Enterprise Library 5.0 @ patterns & practices symposium 2010 Please wait while the Setup Wizard prepares to guide you through the installation

2 Context  Reusable components are important − Address common enterprise development challenges consistently across applications  Application Blocks are a form factor for reusable components − Reusable, testable, extensible and modifiable source code − + docs, hands-on labs  Enterprise Library is a set of general purpose application blocks − Not specific to any one application type or architectural style  Can be used as-is or as a starting point for your own libraries or frameworks 2 YOU SIMPLY CANNOT AFFORD NOT TO REUSE! WHEN IT COMES TO CODE WRITING, LESS IS MORE!

3 Enterprise Library – Big Picture 3

4 EntLib Design Goals  Consistency (Логическая последовательность) − Blocks are written with and used in common patterns  Extensibility (Расширяемость) − Pluggable extension points  Ease of use (Простота эксплуатации) − Config tool, tons of docs, simple interfaces, labs, webcasts  Integration (Интеграционная слаженность) − Work well together or separately

5 Key themes  Ease of use  Learnability  Less intrusive  Better testability  Simplification inside and out

6 6 No new blocks Healthy code

7 Where were we?

8 EntLib 4.x

9 Where are we going?

10 Conceptual Architecture Functional blocksWiring blocks

11 Functional blocksCommon Infrastructure Structural/wiring blocks SecuritySecurity DataAccessDataAccess CryptographyCryptography ValidationValidation LoggingLogging CachingCachingExceptionHandlingExceptionHandling UnityUnity ConfigConfig Instrumen- tation Policy Injection Enterprise Library – Conceptual Architecture

12 A-la carte approach 12 You only need to use features relevant to you!

13 .NET 4.0 / VS 2010  Binaries –Signed –Target.NET 3.5 SP1 –Work unchanged in.NET 4.0 projects  Source –VS 2008 sln/proj targeting 3.5 SP1 –VS 2010 sln/proj targeting 4.0  Config tool –Fully integrated editor in VS 2008 –Launcher from VS 2010 (like WCF config tool)

14 Logging Scenarios  You need to log business and operations data to various destinations, which are externally configurable  You need to provide tracing to support production debugging  You need to provide auditing for increased security  You need to be able to specify which messages go where, and how they are formatted  You need to be able to log messages to a wide variety of destinations  … while meeting your perf objectives!

15 Ease of use! Demo Adding logging to your app in ~3 mins!

16 Getting Enterprise Library objects 16

17 Config Experience  New config tool  IntelliSense in XML editor  Programmatic config support  New configuration sources

18 Config Tool Stories  Usability: Improve intuitiveness & learnability  Simplicity: Reduce the number of design time assemblies  Extensibility: Simplify the way config for custom handlers/providers/blocks can be plugged into the config tool

19 Config Tool Experience Demo

20 Twelve Architecture & Usage of EntLib

21 Fluent Configuration Interface  Motivation: – Customer requested a better way to configure EntLib programmatically – Make our own test cases more readable Ref: Martin Fowler, Eric Evans. http://martinfowler.com/bliki/FluentInterface.html

22 Programmatic Config Experience Demo

23 Hierarchical / Redirected config  Use a non-default config store  Split config into multiple physical files  Combine them at runtime  Allows master + override style of config –Runtime version of environmental overrides

24 Logging Block Performance  Originally, planned to implement async logging  Perf analysis of the lower level operations of the logging block (v4.1) showed: − The formatter took 54% of the total time − Of this, the most expensive operations are:  11.76 Getting the machine name  9.63 Computing Severity textual representation  5.70 Undetermined mscorwks.dll work  5.17 Computing DateTime textual representation  4.46 StringBuilder.Append  4.10 Getting the process name

25 Higher Performing Logging – Implementation 1.Added 3 predefined timestamp patterns mapped to hi-speed formatting implementations. − FixedFormatISOInternationalDate: yyyy-MM-dd − FixedFormatUSDate: MM/dd/yyyy − FixedFormatTime: HH:mm:ss.fff Note: These named patterns work with the standard {timestamp()} token, and can be used with the local: modifier 2.Added 4 new "local" tokens for context info. − localAppDomain − localMachine − localProcessName − localProcessId 3.Modified default template to take advantage of 1 and 2.

26 upto 20% global improvement Higher Performing Logging – Preliminary Results  Formatter responsible for ~50% of the execution time  Improvements 45% local improvement 53% local improvement N=1M

27 New in Data Access Application Block

28 Processing Results  Data Access block traditionally made it easier to call sprocs  Processing the results still means dropping back into classic ADO.NET code  Issue: how could we make it easier to consume the results of a sproc?

29 Now – using Accessors 29

30 Introducing Data Accessors  Basic idea: –Instead of operating on data readers and data records that you get from a query, get back an IEnumerable –Now we can do LINQ to Objects magic  Accessors –provide a higher level abstraction that combines the command, input mapping, output mapping, and result set management into a single object.  Note: Accessors are easily injectable

31 Data Accessors

32 32 before after

33 DAAB Accessors Demo

34

35 Async DAAB − Database API addition − Follows classic Begin/End async pattern  NonQuery  Scalar  Reader  XmlReader (SQL Server only) − Not supported on all databases

36 Async Data Access var db = EnterpriseLibraryContainer.Current.GetInstance (); if(db.SupportsAsync) { db.BeginExecuteScalar("Get Top Ten Products", CompletionMethod); } public void CompletionMethod(IAsyncResult async) { int count = (int)db.EndExecuteScalar(async);... }

37 Policy Injection Application Block Goals  Separate cross-cutting concerns from business logic − Use interception and injection to apply policies at runtime − Provide a declarative way of specifying which policies are applied where − Define policies using configuration or attributes  Leverage other application blocks to implement common cross-cutting concerns − Validation, Logging, Authorization, Exception Handling, Caching, Performance Counters  Provide flexibility in interception mechanisms  Aspect-Oriented Programming (AOP )

38 Interception 38

39 Interceptors 39

40 Interceptors – Pros & Cons 40

41 Power of Interception Demo

42 Learnability With contributions by Nicolas Botto, Bob Brumfield, Grigori Melnik, Erik Renaud, Fernando Simonazzi, Chris Tavares

43 Key Takeaways  Reuse for the win!  Improving user experience  Simpler, more consistent code base  Simpler to configure and use  Better support for DI-style of development  Focus on testability and maintainability  Engage with us!

44 Call for Action 1.New to EntLib: 1.Start with reading the Dev Guide 2.Download Hands-on labs (5.0) 3.Play! 2.Seasoned EntLib user: 1.Evaluate v5.0 2.Read Migration guide 3.Experiment with migration 4.Provide feedback! 5.Tell your story

45 Resources  Released Enterprise Library and related resources: − msdn.microsoft.com/entlib  Discussions, learning resources and support: − entlib.codeplex.com − unity.codeplex.com  Enterprise Library Community Extensions: − entlibcontrib.codeplex.com  patterns & practices dev center − msdn.microsoft.com/practices  Grigori’s contacts: − grigori.melnik@microsoft.com − blogs.msdn.com/agile − @gmelnik

46


Download ppt "Welcome to Grigori Melnik’s talk on Microsoft Enterprise Library patterns & practices symposium 2010 Please wait while the Setup Wizard prepares."

Similar presentations


Ads by Google