• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Spring.Net, Feb 2008, PostSharp:  A Technical Introduction
 

Spring.Net, Feb 2008, PostSharp: A Technical Introduction

on

  • 1,365 views

 

Statistics

Views

Total Views
1,365
Views on SlideShare
1,364
Embed Views
1

Actions

Likes
0
Downloads
21
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Spring.Net, Feb 2008, PostSharp:  A Technical Introduction Spring.Net, Feb 2008, PostSharp: A Technical Introduction Presentation Transcript

    • PostSharp & Spring.NET 2. PostSharp Architecture
    • you are now supposed to be woken up!
    • however, you should already know that!
    • The Big Picture Plug-Ins PostSharp Core PostSharp Laos Hosts MSBuild Host Command-Line Host Runtime Host
    • A finer picture PostSharp Core Code Object Model represents a .NET module Module Reader reads a .NET binary assembly into the Code Object Model Module Writer writes the Code Object Model into a binary assembly (using ILASM) Code Weaver provides the infrastructure for MSIL injection Platform Infrastructure executes projects, loads plug-ins, loads and schedules tasks Plug-in performs specific analysis or transformation Host bootstraps PostSharp and invoke project executions Independent Program uses PostSharp without the Platform Infrastructure PostSharp Laos PostSharp4EntLib PostSharp.Samples.Trace custom plug-ins command-line utility MSBuild task PostSharp.Samples.Host custom application servers PostSharp.Samples.Explorer
    • Core vs. Laos PostSharp Core PostSharp Laos Objective Absolutely free editing of .NET assemblies Aspect-Oriented Programming Easily Primitives Low-Level (MSIL) High-Level Audience ISV, MSIL/PostSharp specialist Everyone Learning Curve Steep High Complexity / Error Proneness High Low Runtime performance Fast Slower Licensing of extensions GPL/Commercial Any
    • Compared Example: Logging
      • Boring but instructive
      Hello, World
    • have you done your homework?
    • The Laos Solution
      • Derive a custom attribute.
      • Implement “event handlers”.
      • Apply/multicast the custom attribute.
      • Compile-time instantiation.
      • Deserialization.
      • Reflector.
    • The Core Solution
      • Define the Public Interface.
        • Custom Attribute in the example, but anything else is allowed (XML, DSL).
      • Implement the weaver.
        • Advice.
        • Advice Provider (pointcut evaluation).
      • Plug-In Manifest.
      • Discovery.
      • Reflector.
    • Compound Aspects
      • Implement INotifyPropertyChanged .
    • Translating the implementation pattern to AOP Aspected Class Property 1 Property 2 Property 3 NotifyPropertyChangedImpl internal OnPropertyChanged event PropertyChanged Property Setter Aspect OnSuccess handler Composition Aspect
    • Putting it together: Compound Aspect
      • True meta-programming at compile-time.
      • No limitation to custom attributes.
      • The base of PostSharp bridges to Microsoft Enterprise Library or Microsoft Entity Framework.
    • Summary
      • With PostSharp Core, you are completely free but you have to pay the price.
      • PostSharp Laos allows to do pretty much things, but:
        • It is slower: it generates suboptimal instructions .
        • No division of compile-time and run-time logic.
        • Attention to abuses!
    •