SlideShare a Scribd company logo
Drive Application Behavior with
        Application and User Configuration
                     Settings

                      Brian Noyes
             IDesign Inc (www.idesign.net)
               brian.noyes@idesign.net




About Brian
• Chief Architect, IDesign Inc. (www.idesign.net)
• Microsoft Regional Director / MVP
• Writing
        Data Binding in Windows Forms 2.0, Addison Wesley, January 2006
    ●
        Smart Client Deployment with ClickOnce, Addison Wesley, Summer
    ●
        2006
        MSDN Magazine, MSDN Online, CoDe Magazine, The Server Side
    ●
        .NET, asp.netPRO, Visual Studio Magazine
• Speaking
        Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections,
    ●
        DevTeach, INETA Speakers Bureau, MSDN Webcasts
• Participates in Microsoft Design Reviews
• E-mail: brian.noyes@idesign.net
• Blog: http://www.softinsight.com/bnoyes
Agenda

•   Configuration Settings Overview
•   Defining Visual Studio 2005 Settings
•   Programming against Settings
•   Protecting configuration settings
•   Extending the Settings system




How did we get here?

•   Hard coding
•   Ini files
•   Registry
•   Application Configuration files in .NET 1.x
        <appSettings> entries
    ●
        Custom configuration sections
    ●
        Custom settings files
    ●

• Application/User Settings in .NET 2.0
Application Settings Overview

• Relatively static data store for your
  application
• <appname>.exe.config for Windows apps
• Web.config for web apps
• System.Configuration API
• Application scoped
• Read-only access
• Visual Studio 2005 support




User Settings Overview

• Relatively static data store for individual
  users
• User.config under user profile
      <username>Application
  ●
      Data<publisher><obfuscated app name>
• User scoped
• Read/write access
• Visual Studio 2005 support
Agenda

•   Configuration Settings Overview
•   Defining Visual Studio 2005 Settings
•   Programming against Settings
•   Protecting configuration settings
•   Extending the Settings system




Visual Studio Settings
Visual Studio Settings

• Adds Settings Class
        Settings.Designer.cs
    ●
        Partial class
    ●

• Adds values to app.config
        Custom sections
    ●
        Built-in sections (i.e. connectionStrings)
    ●




Agenda

•   Configuration Settings Overview
•   Defining Visual Studio 2005 Settings
•   Programming against Settings
•   Protecting configuration settings
•   Extending the Settings system
Programming against Settings

• Settings class added to child namespace
      <projectname>.Properties
  ●

• Singleton static Default property
      Settings.Default
  ●
      Gives you back an instance of the Settings
  ●
      class
• Read/Write to strongly typed properties
• Save/Refresh methods




Using Settings From Other Assemblies

• Settings defined on a per-project basis
• App.config added to project
• Only exe can have .config file at runtime
      Except custom providers
  ●

• Migrate config file settings into host app
  config or use embedded defaults
Agenda

•   Configuration Settings Overview
•   Defining Visual Studio 2005 Settings
•   Programming against Settings
•   Protecting configuration settings
•   Extending the Settings system




Protecting Configuration Settings

• System.Configuration APIs to encrypt/decrypt
  portions of a config file
        Get Configuration instance
    ●
        Get ConfigurationSection
    ●
        Call SectionInformation.ProtectSection
    ●

• Aspnet_regiis to do it at command line
        -pe, -app, -prov switches
    ●
        Rename config file to web.config for non-Web apps,
    ●
        then rename after encryption
        Tied to machine key
    ●
Agenda

•   Configuration Settings Overview
•   Defining Visual Studio 2005 Settings
•   Programming against Settings
•   Protecting configuration settings
•   Extending the Settings system




Adding Custom Types

• Can read/save any type from settings
• Formatting: String, XML, Binary
• From Visual Studio: Browse… from Type
  drop down
• Custom Type Serialization:
        TypeConverter ToString/FromString
    ●
        XmlSerializer
    ●
Extending Settings

• Derive from ApplicationSettingsBase class
         Can have more than one class
     ●
         Only one supported by VS Settings editor
     ●

• Custom providers
         Save settings somewhere else
     ●
         Derive from SettingsProvider
     ●




Summary

• App/User Settings easy to define and use
• Using built-in types will be fastest
• Can plug in custom types
• Can change storage location with custom
  provider
• Can protect settings in config file
    E-mail: brian.noyes@idesign.net
    Blog: http://www.softinsight.com/bnoyes

More Related Content

Viewers also liked

Comonaceunparadigma
ComonaceunparadigmaComonaceunparadigma
Comonaceunparadigmaplujafina
 
Presentacion de federico
Presentacion de federicoPresentacion de federico
Presentacion de federicofedericohoffman
 
Logomarca
LogomarcaLogomarca
Logomarcacrioula
 
Nba Nfl
Nba NflNba Nfl
Nba Nfl
Pan Wilson
 
Comissao AD HOC "Barreiro Antigo" 2003
Comissao AD HOC "Barreiro Antigo" 2003Comissao AD HOC "Barreiro Antigo" 2003
Comissao AD HOC "Barreiro Antigo" 2003
kimberley
 
Don't worry, try it, now!!!!!
Don't worry, try it, now!!!!!Don't worry, try it, now!!!!!
Don't worry, try it, now!!!!!
Roberto Garcia
 
Understanding Global Community Trends
Understanding Global Community TrendsUnderstanding Global Community Trends
Understanding Global Community Trends
jgatrell
 
Losproblemasalarbol(1)
Losproblemasalarbol(1)Losproblemasalarbol(1)
Losproblemasalarbol(1)
elfo_webcam
 
10 Maneras De Mantener El Humor
10 Maneras De Mantener El Humor10 Maneras De Mantener El Humor
10 Maneras De Mantener El Humorplujafina
 
So no orkut
So no orkutSo no orkut
So no orkut
Rodrigo Vieira
 
Bebida
BebidaBebida
Worthington Walking Tour
Worthington Walking TourWorthington Walking Tour
Worthington Walking Tour
Mike Taylor
 
Cambodian Bloggers Summit: Keynote Presentation
Cambodian Bloggers Summit: Keynote PresentationCambodian Bloggers Summit: Keynote Presentation
Cambodian Bloggers Summit: Keynote Presentation
Beth Kanter
 
EpistemologíA
EpistemologíAEpistemologíA
EpistemologíA
Euler
 
Lo que va, regresa · Alexander Fleming
Lo que va, regresa · Alexander FlemingLo que va, regresa · Alexander Fleming
Lo que va, regresa · Alexander Fleming
quienentravuelve
 

Viewers also liked (20)

Comonaceunparadigma
ComonaceunparadigmaComonaceunparadigma
Comonaceunparadigma
 
Presentacion de federico
Presentacion de federicoPresentacion de federico
Presentacion de federico
 
Logomarca
LogomarcaLogomarca
Logomarca
 
Nba Nfl
Nba NflNba Nfl
Nba Nfl
 
Comissao AD HOC "Barreiro Antigo" 2003
Comissao AD HOC "Barreiro Antigo" 2003Comissao AD HOC "Barreiro Antigo" 2003
Comissao AD HOC "Barreiro Antigo" 2003
 
Don't worry, try it, now!!!!!
Don't worry, try it, now!!!!!Don't worry, try it, now!!!!!
Don't worry, try it, now!!!!!
 
Understanding Global Community Trends
Understanding Global Community TrendsUnderstanding Global Community Trends
Understanding Global Community Trends
 
Losproblemasalarbol(1)
Losproblemasalarbol(1)Losproblemasalarbol(1)
Losproblemasalarbol(1)
 
10 Maneras De Mantener El Humor
10 Maneras De Mantener El Humor10 Maneras De Mantener El Humor
10 Maneras De Mantener El Humor
 
So no orkut
So no orkutSo no orkut
So no orkut
 
Desper.20
Desper.20Desper.20
Desper.20
 
Bebida
BebidaBebida
Bebida
 
Worthington Walking Tour
Worthington Walking TourWorthington Walking Tour
Worthington Walking Tour
 
Apresenta Curso
Apresenta CursoApresenta Curso
Apresenta Curso
 
Cambodian Bloggers Summit: Keynote Presentation
Cambodian Bloggers Summit: Keynote PresentationCambodian Bloggers Summit: Keynote Presentation
Cambodian Bloggers Summit: Keynote Presentation
 
EpistemologíA
EpistemologíAEpistemologíA
EpistemologíA
 
Profesora
ProfesoraProfesora
Profesora
 
Recuerdas
RecuerdasRecuerdas
Recuerdas
 
Observeacachoeira
ObserveacachoeiraObserveacachoeira
Observeacachoeira
 
Lo que va, regresa · Alexander Fleming
Lo que va, regresa · Alexander FlemingLo que va, regresa · Alexander Fleming
Lo que va, regresa · Alexander Fleming
 

Similar to Vac301 Drive Application Behaviorwith Applicationand User Configuration Settings

App301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent LibApp301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent Lib
mcgurk
 
visual basic 2005 programmer certification
visual basic 2005 programmer certificationvisual basic 2005 programmer certification
visual basic 2005 programmer certification
Vskills
 
IIS Web Ecosystem
IIS Web EcosystemIIS Web Ecosystem
IIS Web Ecosystem
Kenny Abdiel Maita
 
Vsts Msdn Presentation2003
Vsts Msdn Presentation2003Vsts Msdn Presentation2003
Vsts Msdn Presentation2003
John Sanderson
 
Office And Vsto 200
Office And Vsto 200Office And Vsto 200
Office And Vsto 200
Mithun T. Dhar
 
Q1 Southern California Session Slides
Q1 Southern California Session SlidesQ1 Southern California Session Slides
Q1 Southern California Session Slides
Harold Wong
 
Windows 8.1 a closer look
Windows 8.1 a closer lookWindows 8.1 a closer look
VMworld 2013: VMware Mirage 201
VMworld 2013: VMware Mirage 201VMworld 2013: VMware Mirage 201
VMworld 2013: VMware Mirage 201
VMworld
 
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft WindowsOpscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft Windows
Chef Software, Inc.
 
Group Policy Preferences, Templates, And Scripting
Group Policy Preferences, Templates, And ScriptingGroup Policy Preferences, Templates, And Scripting
Group Policy Preferences, Templates, And Scripting
Microsoft TechNet
 
Windows 2008 R2 &amp; Windows7
Windows 2008 R2 &amp; Windows7Windows 2008 R2 &amp; Windows7
Windows 2008 R2 &amp; Windows7
Gabe Akisanmi
 
Windows 7 Optimized Desktop
Windows 7 Optimized DesktopWindows 7 Optimized Desktop
Windows 7 Optimized Desktop
IT Masterclasses
 
W7 Enterprise
W7 EnterpriseW7 Enterprise
W7 Enterprisearalves
 
W7 for IT Professionals
W7 for IT ProfessionalsW7 for IT Professionals
W7 for IT Professionalsguest632c73
 
Vs2008 to improve Development
Vs2008  to improve DevelopmentVs2008  to improve Development
Vs2008 to improve Development
maddinapudi
 
.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8
aminmesbahi
 
Explore asp.net core 3.0 features
Explore asp.net core 3.0 featuresExplore asp.net core 3.0 features
Explore asp.net core 3.0 features
iFour Technolab Pvt. Ltd.
 

Similar to Vac301 Drive Application Behaviorwith Applicationand User Configuration Settings (20)

App301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent LibApp301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent Lib
 
Vs2005p
Vs2005pVs2005p
Vs2005p
 
visual basic 2005 programmer certification
visual basic 2005 programmer certificationvisual basic 2005 programmer certification
visual basic 2005 programmer certification
 
IIS Web Ecosystem
IIS Web EcosystemIIS Web Ecosystem
IIS Web Ecosystem
 
Vsts Msdn Presentation2003
Vsts Msdn Presentation2003Vsts Msdn Presentation2003
Vsts Msdn Presentation2003
 
Office And Vsto 200
Office And Vsto 200Office And Vsto 200
Office And Vsto 200
 
Q1 Southern California Session Slides
Q1 Southern California Session SlidesQ1 Southern California Session Slides
Q1 Southern California Session Slides
 
Road Show Asp Net
Road Show Asp NetRoad Show Asp Net
Road Show Asp Net
 
Windows 8.1 a closer look
Windows 8.1 a closer lookWindows 8.1 a closer look
Windows 8.1 a closer look
 
VMworld 2013: VMware Mirage 201
VMworld 2013: VMware Mirage 201VMworld 2013: VMware Mirage 201
VMworld 2013: VMware Mirage 201
 
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft WindowsOpscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft Windows
 
Group Policy Preferences, Templates, And Scripting
Group Policy Preferences, Templates, And ScriptingGroup Policy Preferences, Templates, And Scripting
Group Policy Preferences, Templates, And Scripting
 
Windows 2008 R2 &amp; Windows7
Windows 2008 R2 &amp; Windows7Windows 2008 R2 &amp; Windows7
Windows 2008 R2 &amp; Windows7
 
installaware_faq
installaware_faqinstallaware_faq
installaware_faq
 
Windows 7 Optimized Desktop
Windows 7 Optimized DesktopWindows 7 Optimized Desktop
Windows 7 Optimized Desktop
 
W7 Enterprise
W7 EnterpriseW7 Enterprise
W7 Enterprise
 
W7 for IT Professionals
W7 for IT ProfessionalsW7 for IT Professionals
W7 for IT Professionals
 
Vs2008 to improve Development
Vs2008  to improve DevelopmentVs2008  to improve Development
Vs2008 to improve Development
 
.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8
 
Explore asp.net core 3.0 features
Explore asp.net core 3.0 featuresExplore asp.net core 3.0 features
Explore asp.net core 3.0 features
 

Recently uploaded

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 

Recently uploaded (20)

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 

Vac301 Drive Application Behaviorwith Applicationand User Configuration Settings

  • 1. Drive Application Behavior with Application and User Configuration Settings Brian Noyes IDesign Inc (www.idesign.net) brian.noyes@idesign.net About Brian • Chief Architect, IDesign Inc. (www.idesign.net) • Microsoft Regional Director / MVP • Writing Data Binding in Windows Forms 2.0, Addison Wesley, January 2006 ● Smart Client Deployment with ClickOnce, Addison Wesley, Summer ● 2006 MSDN Magazine, MSDN Online, CoDe Magazine, The Server Side ● .NET, asp.netPRO, Visual Studio Magazine • Speaking Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections, ● DevTeach, INETA Speakers Bureau, MSDN Webcasts • Participates in Microsoft Design Reviews • E-mail: brian.noyes@idesign.net • Blog: http://www.softinsight.com/bnoyes
  • 2. Agenda • Configuration Settings Overview • Defining Visual Studio 2005 Settings • Programming against Settings • Protecting configuration settings • Extending the Settings system How did we get here? • Hard coding • Ini files • Registry • Application Configuration files in .NET 1.x <appSettings> entries ● Custom configuration sections ● Custom settings files ● • Application/User Settings in .NET 2.0
  • 3. Application Settings Overview • Relatively static data store for your application • <appname>.exe.config for Windows apps • Web.config for web apps • System.Configuration API • Application scoped • Read-only access • Visual Studio 2005 support User Settings Overview • Relatively static data store for individual users • User.config under user profile <username>Application ● Data<publisher><obfuscated app name> • User scoped • Read/write access • Visual Studio 2005 support
  • 4. Agenda • Configuration Settings Overview • Defining Visual Studio 2005 Settings • Programming against Settings • Protecting configuration settings • Extending the Settings system Visual Studio Settings
  • 5. Visual Studio Settings • Adds Settings Class Settings.Designer.cs ● Partial class ● • Adds values to app.config Custom sections ● Built-in sections (i.e. connectionStrings) ● Agenda • Configuration Settings Overview • Defining Visual Studio 2005 Settings • Programming against Settings • Protecting configuration settings • Extending the Settings system
  • 6. Programming against Settings • Settings class added to child namespace <projectname>.Properties ● • Singleton static Default property Settings.Default ● Gives you back an instance of the Settings ● class • Read/Write to strongly typed properties • Save/Refresh methods Using Settings From Other Assemblies • Settings defined on a per-project basis • App.config added to project • Only exe can have .config file at runtime Except custom providers ● • Migrate config file settings into host app config or use embedded defaults
  • 7. Agenda • Configuration Settings Overview • Defining Visual Studio 2005 Settings • Programming against Settings • Protecting configuration settings • Extending the Settings system Protecting Configuration Settings • System.Configuration APIs to encrypt/decrypt portions of a config file Get Configuration instance ● Get ConfigurationSection ● Call SectionInformation.ProtectSection ● • Aspnet_regiis to do it at command line -pe, -app, -prov switches ● Rename config file to web.config for non-Web apps, ● then rename after encryption Tied to machine key ●
  • 8. Agenda • Configuration Settings Overview • Defining Visual Studio 2005 Settings • Programming against Settings • Protecting configuration settings • Extending the Settings system Adding Custom Types • Can read/save any type from settings • Formatting: String, XML, Binary • From Visual Studio: Browse… from Type drop down • Custom Type Serialization: TypeConverter ToString/FromString ● XmlSerializer ●
  • 9. Extending Settings • Derive from ApplicationSettingsBase class Can have more than one class ● Only one supported by VS Settings editor ● • Custom providers Save settings somewhere else ● Derive from SettingsProvider ● Summary • App/User Settings easy to define and use • Using built-in types will be fastest • Can plug in custom types • Can change storage location with custom provider • Can protect settings in config file E-mail: brian.noyes@idesign.net Blog: http://www.softinsight.com/bnoyes