SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Policy Injection in ASP.NET  using Enterprise Library 3.0 Alex Homer [email_address] http://www.daveandal.net
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Terminology and Buzzwords ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What are Crosscutting Concerns? Core Concerns Application Business  Object Business  Object Data Access Object Application Business  Object Data Access Object Validation Logging Exception Handling Caching Authorization Crosscutting Concerns Performance Counters
What is Policy Injection? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Handlers Pipeline ,[object Object],[object Object],[object Object],[object Object]
Interceptable Object Types (1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],VB.NET: object  = PolicyInjection.Create(Of  type )( ctor_params ) object  = PolicyInjection.Create(Of  type )(IConfigurationSource,  params ) object  = PolicyInjection.Wrap(Of  type )( existing_object ) object  = PolicyInjection.Wrap(Of  type )(IConfigurationSource,  object ) C# Visual Basic .NET
Interceptable Object Types (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],C# interface  = PolicyInjection.Create(Of  type ,  interface )( ctor_params ) interface  = PolicyInjection.Create (Of  type ,  interface ) _ (IConfigurationSource,  ctor_params ) interface  = PolicyInjection.Wrap (Of  interface )  ( existing_object ) interface  = PolicyInjection.Wrap (Of  interface ) _ (IConfigurationSource,  existing_object ) Visual Basic .NET
Configuring Policies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Configuring Policies Demo Demo
Demo Business Object Members Public members exposed by the two business objects Member Attributed Customer Model Interface Customer Model Notes GetCustomerList()   GetCustomerName(customerID)   GetCustomerNameWithWildcard (customerID)   Uses GetCustomerName method with a wildcard. GetCustomerDetails(customerID)   Not defined in interface. GetCityList(minimumCount)   CityCount   Property. Uses GetCityList
Demo Policies The policies defined in the example application Policy Name Matching Rules Call Handlers InterfaceModelPolicy Member Name = GetCustomerNameWithWildcard or GetCustomerList Type Name = InterfaceCustomerModel Logging Handler with Categories = "AuditFile" and "EventLog" Caching Handler with cache duration 20 seconds Exception Handler with Exception Policy = "CustomerModelPolicy” AttributeModelPolicy Method Signature, Name = * and parameter = System.String Type Name = AttributedCustomerModel Logging Handler with Categories = "AuditFile" CacheByTagPolicy Tag Attribute = "ApplyTenSecondCaching" Caching Handler with cache duration 10 seconds
Using Attributes (1) ,[object Object],[CachingCallHandler(0, 0, 30)] public DataTable GetCustomerList() { … } C# <CachingCallHandler(0, 0, 30)> _ Public Sub GetCustomerList() As  DataTable  … End Sub Visual Basic .NET
Using Attributes (2) ,[object Object],[ValidationCallHandler] [ValidationCallHandler] public String GetCustomerName( [StringLengthValidator(3, RangeBoundaryType.Inclusive,  5, RangeBoundaryType.Inclusive)]  String customerID) C# <ValidationCallHandler()> _ Public Function GetCustomerName( _ <StringLengthValidator(3, RangeBoundaryType.Inclusive, _ 5, RangeBoundaryType.Inclusive)> _ ByVal customerID As String) As  String  Visual Basic .NET
Using Attributes (3) ,[object Object],[ApplyNoPolicies] public DataTable GetCustomerList() … C# <  ApplyNoPolicies > _ Public Sub GetCustomerList() As  DataTable  … Visual Basic .NET ,[object Object],[object Object]
Using Attributes Demo Demo
Factory Proxy Handlers Matching  Rules Pipeline
Extending the PIAB ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Inside a Matching Rule ,[object Object],[object Object],[object Object],[object Object],// for example… the built-in Tag Attribute Matching Rule uses: public bool Matches(MethodBase member) { foreach (TagAttribute tagAttribute in GetAllAttributes(member, true)) { if (string.Compare(tagAttribute.Tag, tagToMatch, ignoreCase) == 0) return true; } return false; }
Inside a Pipeline Handler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Handler Process Overview public class ExampleHandler : ICallHandler { public IMethodReturn Invoke(IMethodInvocation  input , GetNextHandlerDelegate  getNext ) { // Perform any pre-processing tasks required in the custom handler. ... // Invoke next handler that the block should execute. This code gets the current return message that you must pass back to the caller: IMethodReturn msg = getNext()(input, getNext);  ... // Perform any post-processing tasks required in the custom handler. // You can modify the return message if required. // Return the message to the previous handler or the client.  return msg; }
Messages and Short-Circuiting Each handler invokes the next one, passing the invocation message along the pipeline and the return message back again A handler can instead simply refuse to call the next handler, and can add information (e.g. an exception) to the return message. Note that previous handlers still execute
Short-Circuiting Execution public IMethodReturn Invoke(IMethodInvocation  input , GetNextHandlerDelegate  getNext ) { GregorianCalendar cal = new GregorianCalendar(); DayOfWeek weekDay = cal.GetDayOfWeek(DateTime.Now); if (weekDay == DayOfWeek.Saturday || weekDay == DayOfWeek.Sunday)  { // create an Exception to return and the return message. Exception ex = new Exception(&quot;Available on weekdays only&quot;); IMethodReturn msg = input.CreateExceptionMethodReturn(ex) return msg;  } else { return getNext()(input, getNext);  // invoke the next handler  }
Custom Handler Attributes [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property |  AttributeTargets.Method)] public class CachingCallHandlerAttribute : HandlerAttribute { private TimeSpan expirationTime; public CachingCallHandlerAttribute(int  hours , int  minutes , int  seconds ) {  // constructor, save the parameter values expirationTime = new TimeSpan(hours, minutes, seconds); } public override ICallHandler CreateHandler() {  // create the appropriate handler instance and return it return new CachingCallHandler(expirationTime); } }
References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://www.codeplex.com

Weitere ähnliche Inhalte

Was ist angesagt?

GWT integration with Vaadin
GWT integration with VaadinGWT integration with Vaadin
GWT integration with VaadinPeter Lehto
 
ASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationEyal Vardi
 
Object Oreinted Approach in Coldfusion
Object Oreinted Approach in ColdfusionObject Oreinted Approach in Coldfusion
Object Oreinted Approach in Coldfusionguestcc9fa5
 
Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27
Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27
Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27Horacio Gonzalez
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)Carles Farré
 
MongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB
 
Michał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processesMichał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processesRST Software Masters
 
Udi Dahan Intentions And Interfaces
Udi Dahan Intentions And InterfacesUdi Dahan Intentions And Interfaces
Udi Dahan Intentions And Interfacesdeimos
 
Introduction to Google Guice
Introduction to Google GuiceIntroduction to Google Guice
Introduction to Google GuiceKnoldus Inc.
 
Mvc & java script
Mvc & java scriptMvc & java script
Mvc & java scriptEyal Vardi
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTechAntya Dev
 
Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8Peter Lehto
 

Was ist angesagt? (20)

Jsr 303
Jsr 303Jsr 303
Jsr 303
 
GWT integration with Vaadin
GWT integration with VaadinGWT integration with Vaadin
GWT integration with Vaadin
 
ASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 Validation
 
JavaScript Refactoring
JavaScript RefactoringJavaScript Refactoring
JavaScript Refactoring
 
Object Oreinted Approach in Coldfusion
Object Oreinted Approach in ColdfusionObject Oreinted Approach in Coldfusion
Object Oreinted Approach in Coldfusion
 
Devoxx 2012 (v2)
Devoxx 2012 (v2)Devoxx 2012 (v2)
Devoxx 2012 (v2)
 
Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27
Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27
Il n'y a pas que Polymer dans la vie… - RennesJS - 2017-06-27
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
 
MongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB Stitch Tutorial
MongoDB Stitch Tutorial
 
Michał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processesMichał Kopacz: Ports and adapters architecture for business processes
Michał Kopacz: Ports and adapters architecture for business processes
 
Graphql, REST and Apollo
Graphql, REST and ApolloGraphql, REST and Apollo
Graphql, REST and Apollo
 
Backbone Basics with Examples
Backbone Basics with ExamplesBackbone Basics with Examples
Backbone Basics with Examples
 
J2EE jsp_03
J2EE jsp_03J2EE jsp_03
J2EE jsp_03
 
Udi Dahan Intentions And Interfaces
Udi Dahan Intentions And InterfacesUdi Dahan Intentions And Interfaces
Udi Dahan Intentions And Interfaces
 
Introduction to Google Guice
Introduction to Google GuiceIntroduction to Google Guice
Introduction to Google Guice
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
Mvc & java script
Mvc & java scriptMvc & java script
Mvc & java script
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTech
 
Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8
 
Solving the n + 1 query problem
Solving the n + 1 query problemSolving the n + 1 query problem
Solving the n + 1 query problem
 

Ähnlich wie Policy Injection in ASP.NET using Enterprise Library 3.0

Diving in the Flex Data Binding Waters
Diving in the Flex Data Binding WatersDiving in the Flex Data Binding Waters
Diving in the Flex Data Binding Watersmichael.labriola
 
Refactoring and code smells
Refactoring and code smellsRefactoring and code smells
Refactoring and code smellsPaul Nguyen
 
Enterprise Library 3.0 Policy Injection Applicatoin Block
Enterprise Library 3.0 Policy Injection Applicatoin BlockEnterprise Library 3.0 Policy Injection Applicatoin Block
Enterprise Library 3.0 Policy Injection Applicatoin Blockmcgurk
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Juan Pablo
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklum Ukraine
 
Oleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)David McCarter
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web APIhabib_786
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptWalid Ashraf
 
Advanced #2 networking
Advanced #2   networkingAdvanced #2   networking
Advanced #2 networkingVitali Pekelis
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databindingBoulos Dib
 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Patterngoodfriday
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass SlidesNir Kaufman
 

Ähnlich wie Policy Injection in ASP.NET using Enterprise Library 3.0 (20)

Diving in the Flex Data Binding Waters
Diving in the Flex Data Binding WatersDiving in the Flex Data Binding Waters
Diving in the Flex Data Binding Waters
 
Refactoring and code smells
Refactoring and code smellsRefactoring and code smells
Refactoring and code smells
 
Rhino Mocks
Rhino MocksRhino Mocks
Rhino Mocks
 
Tdd,Ioc
Tdd,IocTdd,Ioc
Tdd,Ioc
 
Enterprise Library 3.0 Policy Injection Applicatoin Block
Enterprise Library 3.0 Policy Injection Applicatoin BlockEnterprise Library 3.0 Policy Injection Applicatoin Block
Enterprise Library 3.0 Policy Injection Applicatoin Block
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Working with Servlets
Working with ServletsWorking with Servlets
Working with Servlets
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
 
Oleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoC
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Advanced #2 networking
Advanced #2   networkingAdvanced #2   networking
Advanced #2 networking
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databinding
 
08 Queries
08 Queries08 Queries
08 Queries
 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 

Mehr von PhilWinstanley

Using New Data Types In2008
Using New Data Types In2008Using New Data Types In2008
Using New Data Types In2008PhilWinstanley
 
Getting Started with Enterprise Library 3.0 in ASP.NET
Getting Started with Enterprise Library 3.0 in ASP.NETGetting Started with Enterprise Library 3.0 in ASP.NET
Getting Started with Enterprise Library 3.0 in ASP.NETPhilWinstanley
 
Object Relational Mapping In Real World Applications
Object Relational Mapping In Real World ApplicationsObject Relational Mapping In Real World Applications
Object Relational Mapping In Real World ApplicationsPhilWinstanley
 

Mehr von PhilWinstanley (6)

Spatial SQL
Spatial SQLSpatial SQL
Spatial SQL
 
Using New Data Types In2008
Using New Data Types In2008Using New Data Types In2008
Using New Data Types In2008
 
Translation
TranslationTranslation
Translation
 
Go With The Flow
Go With The FlowGo With The Flow
Go With The Flow
 
Getting Started with Enterprise Library 3.0 in ASP.NET
Getting Started with Enterprise Library 3.0 in ASP.NETGetting Started with Enterprise Library 3.0 in ASP.NET
Getting Started with Enterprise Library 3.0 in ASP.NET
 
Object Relational Mapping In Real World Applications
Object Relational Mapping In Real World ApplicationsObject Relational Mapping In Real World Applications
Object Relational Mapping In Real World Applications
 

Kürzlich hochgeladen

Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Roland Driesen
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsApsara Of India
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLSeo
 
Sales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for SuccessSales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for SuccessAggregage
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth MarketingShawn Pang
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurSuhani Kapoor
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...Any kyc Account
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfPaul Menig
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒anilsa9823
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.Aaiza Hassan
 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Tina Ji
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetDenis Gagné
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Roomdivyansh0kumar0
 
Best Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaBest Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaShree Krishna Exports
 

Kürzlich hochgeladen (20)

Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
 
Sales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for SuccessSales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for Success
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdf
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.
 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
 
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
 
Best Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in IndiaBest Basmati Rice Manufacturers in India
Best Basmati Rice Manufacturers in India
 
Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517
Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517
Nepali Escort Girl Kakori \ 9548273370 Indian Call Girls Service Lucknow ₹,9517
 

Policy Injection in ASP.NET using Enterprise Library 3.0

  • 1. Policy Injection in ASP.NET using Enterprise Library 3.0 Alex Homer [email_address] http://www.daveandal.net
  • 2.
  • 3.
  • 4. What are Crosscutting Concerns? Core Concerns Application Business Object Business Object Data Access Object Application Business Object Data Access Object Validation Logging Exception Handling Caching Authorization Crosscutting Concerns Performance Counters
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 11. Demo Business Object Members Public members exposed by the two business objects Member Attributed Customer Model Interface Customer Model Notes GetCustomerList()   GetCustomerName(customerID)   GetCustomerNameWithWildcard (customerID)   Uses GetCustomerName method with a wildcard. GetCustomerDetails(customerID)   Not defined in interface. GetCityList(minimumCount)   CityCount   Property. Uses GetCityList
  • 12. Demo Policies The policies defined in the example application Policy Name Matching Rules Call Handlers InterfaceModelPolicy Member Name = GetCustomerNameWithWildcard or GetCustomerList Type Name = InterfaceCustomerModel Logging Handler with Categories = &quot;AuditFile&quot; and &quot;EventLog&quot; Caching Handler with cache duration 20 seconds Exception Handler with Exception Policy = &quot;CustomerModelPolicy” AttributeModelPolicy Method Signature, Name = * and parameter = System.String Type Name = AttributedCustomerModel Logging Handler with Categories = &quot;AuditFile&quot; CacheByTagPolicy Tag Attribute = &quot;ApplyTenSecondCaching&quot; Caching Handler with cache duration 10 seconds
  • 13.
  • 14.
  • 15.
  • 17. Factory Proxy Handlers Matching Rules Pipeline
  • 18.
  • 19.
  • 20.
  • 21. Handler Process Overview public class ExampleHandler : ICallHandler { public IMethodReturn Invoke(IMethodInvocation input , GetNextHandlerDelegate getNext ) { // Perform any pre-processing tasks required in the custom handler. ... // Invoke next handler that the block should execute. This code gets the current return message that you must pass back to the caller: IMethodReturn msg = getNext()(input, getNext); ... // Perform any post-processing tasks required in the custom handler. // You can modify the return message if required. // Return the message to the previous handler or the client. return msg; }
  • 22. Messages and Short-Circuiting Each handler invokes the next one, passing the invocation message along the pipeline and the return message back again A handler can instead simply refuse to call the next handler, and can add information (e.g. an exception) to the return message. Note that previous handlers still execute
  • 23. Short-Circuiting Execution public IMethodReturn Invoke(IMethodInvocation input , GetNextHandlerDelegate getNext ) { GregorianCalendar cal = new GregorianCalendar(); DayOfWeek weekDay = cal.GetDayOfWeek(DateTime.Now); if (weekDay == DayOfWeek.Saturday || weekDay == DayOfWeek.Sunday) { // create an Exception to return and the return message. Exception ex = new Exception(&quot;Available on weekdays only&quot;); IMethodReturn msg = input.CreateExceptionMethodReturn(ex) return msg; } else { return getNext()(input, getNext); // invoke the next handler }
  • 24. Custom Handler Attributes [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Method)] public class CachingCallHandlerAttribute : HandlerAttribute { private TimeSpan expirationTime; public CachingCallHandlerAttribute(int hours , int minutes , int seconds ) { // constructor, save the parameter values expirationTime = new TimeSpan(hours, minutes, seconds); } public override ICallHandler CreateHandler() { // create the appropriate handler instance and return it return new CachingCallHandler(expirationTime); } }
  • 25.