Click here to Skip to main content
15,880,651 members
Articles / Desktop Programming / WPF

Using WPF MVVM for Database Access

Rate me:
Please Sign up or sign in to vote.
4.97/5 (31 votes)
2 Nov 2010CPOL13 min read 211.3K   27.2K   113  
An example of a WPF MVVM utility accessing a simple legacy database.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="ProductMvvm.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <connectionStrings>
        <add name="ProductMvvm.Properties.Settings.xstoredbConnectionString"
            connectionString="Data Source=DOUG-PC;Initial Catalog=xstoredb;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
    <userSettings>
        <ProductMvvm.Properties.Settings>
            <setting name="StoreDBConnString" serializeAs="String">
                <value>Server=Doug-PC;Database=xstoreDB;Trusted_Connection=True;</value>
            </setting>
        </ProductMvvm.Properties.Settings>
    </userSettings>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions