Th26 - Building High Quality Solutions with
Design Patterns & Application Foundations
for SharePoint 2010
Christoffer von ...
Agenda
•
•
•
•
•

Design Patterns – what, why and when?
Repository Pattern
Service Locator Pattern
Model-View-Presenter Pa...
SharePoint vs .NET development
• SharePoint is just a .NET application, right?
• So are there really any differences betwe...
Design Patterns
• What is it?
• Why should we use it?
• When should we use it?
Repository Pattern
Business
Entity

Client
Business
Logic

Repository

Persist

Retrieve
Business
Entity

Data
Source
Enti...
Model-View-Presenter Pattern
View
IView

Presenter
Model
Service Locator Pattern
Service A
Class

Service Locator
Service B
Application Foundations for SP2010
• SharePoint Service Locator
• Logger
• Configuration Settings Manager
SharePoint Service Locator
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.SharePoint.Common.ServiceL...
Other options for Service Location
•
•
•
•
•

Custom implementation
Unity
Spring.NET
StructureMap
Other frameworks
Logger
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.SharePoint.Common.ServiceLocation;
using Micro...
Configuration Settings
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.SharePoint.Common.Configuratio...
Summary
• Learn about the different design patterns and
when to use them
• Use Application Foundations for common
tasks su...
Questions?
Resources
Developing Applications for SharePoint 2010
http://msdn.microsoft.com/en-us/library/ff770300.aspx
Developing App...
Keep in touch!
E-mail: christoffer.von.sabsay@sogeti.se
Blog: http://christoffervonsabsay.wordpress.com
Twitter: sabsay
Upcoming SlideShare
Loading in...5
×

Building High Quality Solutions with Design Patterns & Application Foundations for SharePoint 2010 presented by Christoffer von Sabsay

258

Published on

One of SharePoint’s greatest strengths is its flexibility and the possibility to quickly build powerful solutions with the web UI and SharePoint Designer. However, when building business critical enterprise applications, it’s important to make your solution maintainable by using the same standard design patterns and best practices that applies to ordinary .NET development.

In this session, we will talk about several different design patterns such as repository, service location and model-view-presenter that will help you build SharePoint solutions that are flexible, testable and maintainable. We will discuss the different considerations you have to make when deciding to use these patterns. We will also go through the Application Foundations library for SharePoint 2010 from Microsoft, which provides support for managing configuration, service location and logging.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
258
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Building High Quality Solutions with Design Patterns & Application Foundations for SharePoint 2010 presented by Christoffer von Sabsay

  1. 1. Th26 - Building High Quality Solutions with Design Patterns & Application Foundations for SharePoint 2010 Christoffer von Sabsay christoffer.von.sabsay@sogeti.se
  2. 2. Agenda • • • • • Design Patterns – what, why and when? Repository Pattern Service Locator Pattern Model-View-Presenter Pattern Application Foundations for SharePoint 2010
  3. 3. SharePoint vs .NET development • SharePoint is just a .NET application, right? • So are there really any differences between SharePoint and plain .NET development?
  4. 4. Design Patterns • What is it? • Why should we use it? • When should we use it?
  5. 5. Repository Pattern Business Entity Client Business Logic Repository Persist Retrieve Business Entity Data Source Entity – Data Mapping
  6. 6. Model-View-Presenter Pattern View IView Presenter Model
  7. 7. Service Locator Pattern Service A Class Service Locator Service B
  8. 8. Application Foundations for SP2010 • SharePoint Service Locator • Logger • Configuration Settings Manager
  9. 9. SharePoint Service Locator using Microsoft.Practices.ServiceLocation; using Microsoft.Practices.SharePoint.Common.ServiceLocation; IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent(); IServiceLocatorConfig typeMappings = serviceLocator.GetInstance<IServiceLocatorConfig>(); typeMappings.RegisterTypeMapping<IService1, Service1>(); IService1 service1 = serviceLocator.GetInstance<IService1>();
  10. 10. Other options for Service Location • • • • • Custom implementation Unity Spring.NET StructureMap Other frameworks
  11. 11. Logger using Microsoft.Practices.ServiceLocation; using Microsoft.Practices.SharePoint.Common.ServiceLocation; using Microsoft.Practices.SharePoint.Common.Logging; using Microsoft.SharePoint.Administration; IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent(); ILogger logger = serviceLocator.GetInstance<ILogger>(); logger.TraceToDeveloper("My message."); logger.TraceToDeveloper("My message.", TraceSeverity.High); logger.LogToOperations(msg, EventSeverity.Error);
  12. 12. Configuration Settings using Microsoft.Practices.ServiceLocation; using Microsoft.Practices.SharePoint.Common.Configuration; using Microsoft.Practices.SharePoint.Common.ServiceLocation; IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent(); IConfigManager configManager = serviceLocator.GetInstance<IConfigManager>(); IPropertyBag bag = configManager.GetPropertyBag(ConfigLevel.CurrentSPWebApplication); configManager.SetInPropertyBag("MySetting", DateTime.Now, bag); IHierarchicalConfig config = serviceLocator.GetInstance<IHierarchicalConfig>(); if(config.ContainsKey("MySetting")) lastUpdate = config.GetByKey<DateTime>("MySetting"); configManager.RemoveKeyFromPropertyBag("MySetting", bag);
  13. 13. Summary • Learn about the different design patterns and when to use them • Use Application Foundations for common tasks such as configuration and logging
  14. 14. Questions?
  15. 15. Resources Developing Applications for SharePoint 2010 http://msdn.microsoft.com/en-us/library/ff770300.aspx Developing Applications for SharePoint 2007 http://msdn.microsoft.com/en-us/library/ff800762.aspx Application Foundations for SharePoint 2010 http://msdn.microsoft.com/en-us/library/ff798371.aspx
  16. 16. Keep in touch! E-mail: christoffer.von.sabsay@sogeti.se Blog: http://christoffervonsabsay.wordpress.com Twitter: sabsay
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×