1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
|
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="../../../../Common/Overview.xsl" type="text/xsl"?>
<VSSDKSample>
<ImagePath>../../../../Common</ImagePath>
<Status>
<Accessibility>true</Accessibility>
<ArchitectureDiagram>false</ArchitectureDiagram>
<Comments>true</Comments>
<Documentation>true</Documentation>
<ErrorHandling>true</ErrorHandling>
<FollowSDKCodingStandards>true</FollowSDKCodingStandards>
<Localizable>true</Localizable>
<Overview>true</Overview>
<ScenarioTests>true</ScenarioTests>
<Supported>true</Supported>
<UnitTests>true</UnitTests>
<Style>Example</Style>
</Status>
<Overview>
<ShortName>C# Example.ExtendedProvider</ShortName>
<LongName>C# Extended DDEX Provider Sample</LongName>
<Phrase>Demonstrates how to implement a scenario-complete DDEX provider.</Phrase>
</Overview>
<Introduction>
<Summary>
This sample demonstrates how to implement a DDEX provider based on the
.NET Framework Data Provider for SQL Server that supports all the common
data design time scenarios.
</Summary>
<Goal>Supplying all features of the basic DDEX provider sample</Goal>
<Goal>Embedding the XML support files as assembly resources</Goal>
<Goal>Customizing the data object selector service</Goal>
<Goal>Customizing the data object identifier resolver service</Goal>
<Goal>Customizing the data source information service</Goal>
<Goal>Enabling localization of many exposed strings</Goal>
<Goal>Supporting all the common data design time scenarios</Goal>
</Introduction>
<SampleInfo>
<State>New</State>
<Type>Example</Type>
<Complexity>1</Complexity>
<Screenshot />
<Area>Data</Area>
<Language>C#</Language>
<Folder>VisualStudioIntegration\Samples\Data\CSharp\Example.ExtendedProvider\</Folder>
<SampleSolution>ExtendedProvider.sln</SampleSolution>
<FolderUnitTest>VisualStudioIntegration\Samples\Data\CSharp\Example.ExtendedProvider\UnitTests</FolderUnitTest>
<UnitTestStartup>ExtendedProvider.UnitTests.csproj</UnitTestStartup>
<Doc />
<Keywords>
<Keyword>Data</Keyword>
<Keyword>DDEX</Keyword>
<Keyword>Provider</Keyword>
</Keywords>
</SampleInfo>
<GettingStarted>
<Paragraph>
This sample focuses on fixing the issues surrounding the data design time
scenarios that were in the basic DDEX provider sample. This is done by
providing an assembly containing code that customizes key parts of the
provider.
</Paragraph>
<Paragraph>
The main addition in this sample is a custom data object selector to
supplement or in some cases replace the schema information returned by
the .NET Framework Data Provider for SQL Server. This includes providing
information such as the server instance name, the default schema, as well
as collections like indexes and index columns (which include primary
and unique keys), foreign keys and foreign key columns, stored procedures
and stored procedure parameters and columns, and user-defined functions
and user-defined function parameters and columns.
</Paragraph>
<Paragraph>
A further addition is a custom object identifier resolver, which
correctly expands an identifier based on the active connection. For
example, if the identifier "Customers" is supplied, the active connection
can expand this to "Northwind.dbo.Customers" based on the current active
database and default schema in that database.
</Paragraph>
<Paragraph>
Other enhancements include a customized data source information class
to return properties that require computing and the localization of
some strings.
</Paragraph>
<Paragraph>
Due to the extensions added in this sample, this provider will only
connect to instances of Microsoft SQL Server 2005 or later. Also note
that table-valued functions with parameters are not supported in some
data design scenarios due to a lack of extensibility in this area.
</Paragraph>
<Paragraph>
Since there is already a DDEX provider based on the .NET Framework Data
Provider for SQL Server that ships with Visual Studio, installing another
such provider has potential for ambiguity, as many data design scenarios
refer to the ADO.NET provider invariant name only and from this there is
a one-to-many mapping to DDEX providers. To ensure that this sample DDEX
provider is being used for the various data design scenarios, make sure
the last selected data source and provider combination in the data
connection dialog uses this sample DDEX provider. Visual Studio
incorporates a heuristic for determining the correct DDEX provider to use
given an ADO.NET invariant name that is based on the last provider
selection made for each registered DDEX data source.
</Paragraph>
</GettingStarted>
<BuildingTheSample>
<Step>
Open the <bold>ExtendedProvider.sln</bold> solution.
</Step>
<Step>
Press F5 to build the sample and register it in the experimental instance,
then launch Visual Studio from the experimental instance.
</Step>
<Step>
Alternatively, run the <bold>Install.cmd /ranu</bold> script from a
command line, passing in a Visual Studio registry root (optional) and
location of the built assembly binary (required). The Visual Studio
registry root defaults to the SDK experimental instance. Exclude the
<bold>/ranu</bold> argument when installing to a non-experimental Visual
Studio registry hive.
</Step>
</BuildingTheSample>
<RunningTheSample>
<SampleTask>
<Description>
To add a data connection...
</Description>
<Step>
On the <bold>View</bold> menu, click <bold>Server Explorer</bold>.
</Step>
<Step>
In the <bold>Server Explorer</bold> window, right click the <bold>Data
Connections</bold> node and choose <bold>Add Connection...</bold>.
</Step>
<Step>
If the <bold>Add Connection</bold> dialog shows, click the <bold>
Change...</bold> button to show the <bold>Change Data Source</bold>
dialog.
</Step>
<Step>
Pick the <bold>Microsoft SQL Server</bold> data source and drop down
the <bold>Data Provider</bold> combo box, then choose this sample's
data provider (marked as "Extended Sample").
</Step>
<Step>
Click <bold>OK</bold> to move to the <bold>Add Connection</bold>
dialog.
</Step>
<Step>
In the property grid, enter information to connect to an instance of
Microsoft SQL Server. For the SQL Express instance installed by
default with Visual Studio, enter ".\SQLEXPRESS" as the <bold>Data
Source</bold> value.
</Step>
<Step>
Click <bold>OK</bold> to create a connection in the Server Explorer.
</Step>
</SampleTask>
<SampleTask>
<Description>
To enumerate data objects...
</Description>
<Step>
Follow the steps for adding a data connection with this provider.
</Step>
<Step>
Expand the resulting data connection.
</Step>
<Step>
Expand the various nodes to see data objects.
</Step>
</SampleTask>
<SampleTask>
<Description>
To initiate an end-to-end data design time scenario
</Description>
<Step>
Create a new VB or C# project.
</Step>
<Step>
On the <bold>Data</bold> menu, click <bold>Show Data Sources</bold>.
</Step>
<Step>
In the <bold>Data Sources</bold> window, click <bold>Add New Data
Source...</bold>.
</Step>
<Step>
Follow the steps in the Data Source Configuration Wizard.
</Step>
</SampleTask>
</RunningTheSample>
<AdditionalResources>
<Resource>
<Title>Visual Studio SDK Website</Title>
<URL>http://msdn.microsoft.com/vstudio/extend</URL>
</Resource>
</AdditionalResources>
<UnitTests>
<Test>
SqlObjectIdentifierResolverTests.ExpandIdentifierTest. Ensure an
identifier "Customers" is properly expanded to "Northwind", "dbo",
"Customers" given appropriate mocks that return a hard coded default
catalog and schema.
</Test>
<Test>
SqlObjectSelectorTests.SelectObjectsTest. Ensure all the different
enumerations execute successfully and in some cases, check the actual
returned result set.
</Test>
<Test>
SqlSourceInformationTests.ItemIndexerTest. Ensure retrieval of the
default schema executes successfully and returns the correct value.
</Test>
</UnitTests>
<FunctionalTests>
<Test>
See the DDEX SDK documentation for information about functional tests.
</Test>
</FunctionalTests>
<ProjectFiles>
<File>
<Name>ExtendedProvider.reg</Name>
<Description>
This file contains the registry entries that register this provider.
</Description>
</File>
<File>
<Name>SqlObjectIdentifierResolver.cs</Name>
<Description>
This file contains the custom implementation of the data object
identifier resolver connection service.
</Description>
</File>
<File>
<Name>SqlObjectSelector.cs</Name>
<Description>
This file contains the custom implementation of the data object
selector connection service.
</Description>
</File>
<File>
<Name>SqlObjectSupport.xml</Name>
<Description>
This file defines the structure of the data source as a set of objects.
</Description>
</File>
<File>
<Name>SqlObjectTypes.cs</Name>
<Description>
This file contains static strings identifying the different types of
objects defined in the data object support XML file, for programmatic
purposes.
</Description>
</File>
<File>
<Name>SqlSourceInformation.cs</Name>
<Description>
This file contains the custom implementation of the data source
information connection service.
</Description>
</File>
<File>
<Name>SqlViewSupport.xml</Name>
<Description>
This file defines the presentation of the data source objects in a
hierarchical form.
</Description>
</File>
</ProjectFiles>
<History>
<Change>
<Date>2007-07-08</Date>
<Description>
Created this sample for the Visual Studio 2008 SDK.
</Description>
</Change>
</History>
</VSSDKSample>
|