98-372 · Question #104
Consider the following scenario: Allen has created a Windows Presentation Foundation (WPF) database application using .NET Framework 4.0. The application helps users keep track of their e-Book…
The correct answer is B. As a setting with application scope. The database connection string will be stored in Allen's WPF database application as a setting with application scope. Given that all users on a computer make use of the same database, it does not require being different for different users. Application settings provide a…
Question
Consider the following scenario:
Allen has created a Windows Presentation Foundation (WPF) database application using .NET Framework 4.0. The application helps users keep track of their e-Book collection. Allen identifies that some computers might have many users, such as two roommates might share a computer, with both individuals using the same application on the same computer to manage their e-Book collections. Allen sets up a database to handle many users without mixing up the collections. How will the database connection string be stored in Allen's WPF database application?
Options
- AAs a setting with code behind
- BAs a setting with application scope
- CAs a setting with user scope
- DAs a setting with machine scope
How the community answered
(15 responses)- A7% (1)
- B80% (12)
- C13% (2)
Explanation
The database connection string will be stored in Allen's WPF database application as a setting with application scope. Given that all users on a computer make use of the same database, it does not require being different for different users. Application settings provide a simple means to store application-scoped and user-scoped settings on a client computer. Using Visual Studio, a setting is defined for a specified property by providing its name, data type, and application/user scope. Related settings can also be placed into named groups for easy use and readability. Once defined, these settings are persisted and read back into memory automatically at runtime. A pluggable architecture makes possible the persistence mechanism to be altered, but by default, the local file system is used. Application settings work by persisting data as XML to different configuration files (.config) related to whether the setting is application/user scoped. In most cases, the application-scoped settings are read-only, as they are program information that need not be overwritten. By contrast, user-scoped settings can be read and written safely at runtime, even if the application runs under partial trust. Settings are stored as XML fragments in configuration files. Application-scoped settings are represented by the <application.Settings> element, and are located in app.exe.config, where app is the name of the main executable file. User-scoped settings are represented by the <userSettings> element and are located in user.config, where user is the username of the person presently running the application. The app.exe.config file must be deployed with the application. The settings architecture will create the user.config files on demand when the first time the application saves settings for that A <userSettings> block is defined inside app.exe.config to supply default values for user-scoped
Topics
Community Discussion
No community discussion yet for this question.