Moving Data Sources Between Applications


So, what if you spend several hours building a fancy Data Source and you want to share this work with others on your team or simply include it in another application? It's simple. Follow these few steps to import an existing Data Source (.XSD) into your application.

1.

In the target project, create an Application Setting entry that matches the ConnectionString used in the .XSD file you're importing. Don't know how to name it? Well, that's easy, too. Simply open the .XSD file with any editor and look for the Connection element. It names the AppSettingsPropertyName that you need to re-create. See Figure 6.44 for an example.

Figure 6.44. Exploring a Data Source XSD file for the ConnectionString.


2.

Next, add an "existing" item to your project and browse to the location of the .XSD file. When Visual Studio sees this file, it immediately compiles it to regenerate all of the code built for the source application. Your Data Sources window should populate with all of the top-level objects described by the XSD file.

3.

If you get a compile error when referencing the ConnectionString setting, modify the references to the setting to remove the hard-coded reference to the application name or change it to reflect the application's actual name.




Hitchhiker's Guide to Visual Studio and SQL Server(c) Best Practice Architectures and Examples
Hitchhikers Guide to Visual Studio and SQL Server: Best Practice Architectures and Examples, 7th Edition (Microsoft Windows Server System Series)
ISBN: 0321243625
EAN: 2147483647
Year: 2006
Pages: 227

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net