SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
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

Más contenido relacionado

Destacado

Comonaceunparadigma
ComonaceunparadigmaComonaceunparadigma
Comonaceunparadigmaplujafina
 
Presentacion de federico
Presentacion de federicoPresentacion de federico
Presentacion de federicofedericohoffman
 
Logomarca
LogomarcaLogomarca
Logomarcacrioula
 
Comissao AD HOC "Barreiro Antigo" 2003
Comissao AD HOC "Barreiro Antigo" 2003Comissao AD HOC "Barreiro Antigo" 2003
Comissao AD HOC "Barreiro Antigo" 2003kimberley
 
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 Trendsjgatrell
 
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
 
Worthington Walking Tour
Worthington Walking TourWorthington Walking Tour
Worthington Walking TourMike Taylor
 
Cambodian Bloggers Summit: Keynote Presentation
Cambodian Bloggers Summit: Keynote PresentationCambodian Bloggers Summit: Keynote Presentation
Cambodian Bloggers Summit: Keynote PresentationBeth Kanter
 
EpistemologíA
EpistemologíAEpistemologíA
EpistemologíAEuler
 
Lo que va, regresa · Alexander Fleming
Lo que va, regresa · Alexander FlemingLo que va, regresa · Alexander Fleming
Lo que va, regresa · Alexander Flemingquienentravuelve
 

Destacado (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 a 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 Libmcgurk
 
visual basic 2005 programmer certification
visual basic 2005 programmer certificationvisual basic 2005 programmer certification
visual basic 2005 programmer certificationVskills
 
Vsts Msdn Presentation2003
Vsts Msdn Presentation2003Vsts Msdn Presentation2003
Vsts Msdn Presentation2003John Sanderson
 
Q1 Southern California Session Slides
Q1 Southern California Session SlidesQ1 Southern California Session Slides
Q1 Southern California Session SlidesHarold Wong
 
VMworld 2013: VMware Mirage 201
VMworld 2013: VMware Mirage 201VMworld 2013: VMware Mirage 201
VMworld 2013: VMware Mirage 201VMworld
 
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 WindowsChef Software, Inc.
 
Group Policy Preferences, Templates, And Scripting
Group Policy Preferences, Templates, And ScriptingGroup Policy Preferences, Templates, And Scripting
Group Policy Preferences, Templates, And ScriptingMicrosoft TechNet
 
Windows 2008 R2 &amp; Windows7
Windows 2008 R2 &amp; Windows7Windows 2008 R2 &amp; Windows7
Windows 2008 R2 &amp; Windows7Gabe Akisanmi
 
Windows 7 Optimized Desktop
Windows 7 Optimized DesktopWindows 7 Optimized Desktop
Windows 7 Optimized DesktopIT 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 Developmentmaddinapudi
 
.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 8aminmesbahi
 

Similar a 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
 

Último

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Último (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

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