Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>

View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)</SolutionDir>
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<PackageSources>""</PackageSources>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
<!-- Property that enables building a package from a project -->
<BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
<!-- Commands -->
<RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
<BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>
<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>
<Target Name="CheckPrerequisites">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition="!Exists('$(NuGetExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="Exists('$(PackagesConfig)')" />
</Target>
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true" />
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.IO.Packaging" />
<Using Namespace="System.Linq" />
<Using Namespace="System.Net" />
<Using Namespace="System.Xml" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
string zipTempPath = null;
string exeTempPath = null;
try {
OutputFilename = Path.GetFullPath(OutputFilename);
if (File.Exists(OutputFilename)) {
return true;
}
Log.LogMessage("Determining latest version of NuGet.CommandLine...");
WebClient webClient = new WebClient();
XmlDocument xml = new XmlDocument();
xml.LoadXml(webClient.DownloadString("http://nuget.org/v1/FeedService.svc/Packages()?$filter=tolower(Id)%20eq%20'nuget.commandline'&$top=1&$orderby=Version%20desc"));
XmlNamespaceManager xns = new XmlNamespaceManager(xml.NameTable);
xns.AddNamespace("atom", "http://www.w3.org/2005/Atom");
xns.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices");
xns.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
string version = xml.SelectSingleNode("//atom:entry/m:properties/d:Version", xns).InnerText;
string zipUrl = xml.SelectSingleNode("//atom:entry/atom:content", xns).Attributes["src"].Value;
Log.LogMessage("Downloading NuGet.CommandLine v{0}...", version);
zipTempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
exeTempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
webClient.DownloadFile(zipUrl, zipTempPath);
Log.LogMessage("Copying to {0}...", OutputFilename);
using (Package package = Package.Open(zipTempPath)) {
PackagePart exePart = package.GetParts().Where(p => p.Uri.ToString().ToLowerInvariant() == "/tools/nuget.exe").Single();
using (Stream inputStream = exePart.GetStream(FileMode.Open, FileAccess.Read))
using (Stream outputStream = File.Create(exeTempPath)) {
byte[] buffer = new byte[16384];
while (true) {
int read = inputStream.Read(buffer, 0, buffer.Length);
if (read == 0) {
break;
}
outputStream.Write(buffer, 0, read);
}
}
}
if (!File.Exists(OutputFilename))
{
File.Copy(exeTempPath, OutputFilename);
}
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
finally {
if (exeTempPath != null) File.Delete(exeTempPath);
if (zipTempPath != null) File.Delete(zipTempPath);
}
]]>
</Code>
</Task>
</UsingTask>
</Project>

View File

@@ -0,0 +1 @@
1665c1a1a9444307e60bbe4d1db708833adf9396

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.20703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{42939E33-FC72-459C-9403-B62AB074635E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Samples.VisualStudio.Data.ExtendedProvider</RootNamespace>
<AssemblyName>ExtendedProvider</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.Data.Core" />
<Reference Include="Microsoft.VisualStudio.Data.Framework" />
<Reference Include="Microsoft.VisualStudio.Data.Services" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SqlObjectIdentifierResolver.cs" />
<Compile Include="SqlObjectSelector.cs" />
<Compile Include="SqlObjectTypes.cs" />
<Compile Include="SqlSourceInformation.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="SqlObjectSupport.xml" />
<EmbeddedResource Include="SqlViewSupport.xml" />
</ItemGroup>
<ItemGroup>
<None Include="ExtendedProvider.reg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SampleEntityFrameworkProvider\SampleEntityFrameworkProvider.csproj">
<Project>{eba0b8a0-6c00-44c2-a8f0-394069b9486b}</Project>
<Name>SampleEntityFrameworkProvider</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>"$(ProjectDir)Install.cmd" /ranu /codebase "$(TargetDir)$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp /log</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,138 @@
Windows Registry Editor Version 5.00
;
; The root registry key for the DDEX provider uniquely identifies the
; provider, supplies various names, and registers the main assembly that
; implements the provider using a code base. It also associates the provider
; with a runtime data technology (ADO .NET) and a specific ADO .NET provider.
; Finally, it identifies the default DDEX data source associated with this
; provider, allowing an implicit IVsDataSourceSpecializer support entity
; implementation to be supplied by the DDEX runtime.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%]
@="SampleEntityDDEXProvider"
"AssociatedSource"="{067EA0D9-BA62-43f7-9106-34930C60C528}"
"Codebase"="%CODEBASE%"
"Description"="Provider_Description, Microsoft.Samples.VisualStudio.Data.ExtendedProvider.Properties.Resources"
"DisplayName"="Provider_DisplayName, Microsoft.Samples.VisualStudio.Data.ExtendedProvider.Properties.Resources"
"InvariantName"="SampleEntityFrameworkProvider"
"PlatformVersion"="2.0"
"ShortDisplayName"="Provider_ShortDisplayName, Microsoft.Samples.VisualStudio.Data.ExtendedProvider.Properties.Resources"
"Technology"="{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}"
;
; The SupportedObjects registry key allows a provider to specify which set of
; DDEX support entities it supports in a declarative fashion. This allows the
; DDEX runtime to query capabilities of the provider without actually loading
; it. The set of support entities currently includes those that can be created
; as standalone objects such as the IVsDataConnectionProperties support entity,
; and also those support entities that represent connection services, such as
; the IVsDataCommand support entity.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects]
;
; This registry key indicates the existence of an IDSRefBuilder connection
; service implementation from the DDEX Framework assembly. The default value
; is simply the full name of the type in the assembly that provides the
; implementation. Since this is not in the main provider assembly, an
; Assembly value is used to qualify the type.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IDSRefBuilder]
@="Microsoft.VisualStudio.Data.Framework.DSRefBuilder"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
;
; This registry key indicates the existence of an IVsDataAsyncCommand
; connection service implementation that is built into the service provider
; implemented as part of the AdoDotNetConnectionSupport implementation. Given
; that this is the case, the implementation does not need to be specified here.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataAsyncCommand]
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataCommand]
;
; This registry key indicates the existence of an IVsDataConnectionProperties
; support entity implementation from the main assembly. The DDEX Framework
; assembly contains a number of base implementations of support entities for
; DDEX providers based on a runtime ADO .NET provider; in this case, the
; connection properties object is implemented in terms of an underlying
; DbConnectionStringBuilder object supplied by the ADO .NET provider.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataConnectionProperties]
@="Microsoft.VisualStudio.Data.Framework.AdoDotNet.AdoDotNetConnectionProperties"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataConnectionSupport]
@="Microsoft.VisualStudio.Data.Framework.AdoDotNet.AdoDotNetConnectionSupport"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataConnectionUIProperties]
@="Microsoft.VisualStudio.Data.Framework.AdoDotNet.AdoDotNetConnectionProperties"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataMappedObjectConverter]
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataObjectIdentifierConverter]
;
; This registry key indicates the existence of an
; IVsDataObjectIdentifierResolver connection service implementation that is
; customized by this provider. The default value is simply the full name of
; the type in the main provider assembly.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataObjectIdentifierResolver]
@="Microsoft.Samples.VisualStudio.Data.ExtendedProvider.SqlObjectIdentifierResolver"
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataObjectMemberComparer]
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataObjectSelector]
@="Microsoft.Samples.VisualStudio.Data.ExtendedProvider.SqlObjectSelector"
;
; This registry key indicates the existence of an IVsDataObjectSupport
; connection service implementation. In this sample, a base implementation
; from the DDEX Framework assembly is used that can be constructed given the
; name of a resource and an assembly that contains an XML stream. The DDEX
; runtime reads the XmlResource and Assembly registry values and calls the
; constructor with these values.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataObjectSupport]
@="Microsoft.VisualStudio.Data.Framework.DataObjectSupport"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"XmlResource"="Microsoft.Samples.VisualStudio.Data.ExtendedProvider.SqlObjectSupport"
;
; This registry key indicates the existence of an IVsDataSourceInformation
; connection service implementation that is customized by this provider. The
; custom code does not, however, supply all the key/value pairs; most are
; specified here for flexibility and are merged in by the DDEX runtime.
;
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataSourceInformation]
@="Microsoft.Samples.VisualStudio.Data.ExtendedProvider.SqlSourceInformation"
"SupportsAnsi92Sql"="True"
"SupportsQuotedIdentifierParts"="True"
"IdentifierOpenQuote"="["
"IdentifierCloseQuote"="]"
"ServerSeparator"="."
"CatalogSupported="True"
"CatalogSupportedInDml="True"
"SchemaSupported"="True"
"SchemaSupportedInDml"="True"
"SchemaSeparator"="."
"ParameterPrefix"="@"
"ParameterPrefixInName"="True"
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataTransaction]
[%REGROOT%\DataProviders\%PROVIDERGUID%\SupportedObjects\IVsDataViewSupport]
@="Microsoft.VisualStudio.Data.Framework.DataViewSupport"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"XmlResource"="Microsoft.Samples.VisualStudio.Data.ExtendedProvider.SqlViewSupport"
;
; This registry key registers a mapping from the existing DDEX data source
; for Microsoft SQL Server to this sample provider as a supporting provider.
;
[%REGROOT%\DataSources\{067EA0D9-BA62-43f7-9106-34930C60C528}\SupportingProviders\%PROVIDERGUID%]

View File

@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 11
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExtendedProvider", "ExtendedProvider.csproj", "{42939E33-FC72-459C-9403-B62AB074635E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleEntityFrameworkProvider", "..\SampleEntityFrameworkProvider\SampleEntityFrameworkProvider.csproj", "{EBA0B8A0-6C00-44C2-A8F0-394069B9486B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42939E33-FC72-459C-9403-B62AB074635E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42939E33-FC72-459C-9403-B62AB074635E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42939E33-FC72-459C-9403-B62AB074635E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42939E33-FC72-459C-9403-B62AB074635E}.Release|Any CPU.Build.0 = Release|Any CPU
{EBA0B8A0-6C00-44C2-A8F0-394069B9486B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBA0B8A0-6C00-44C2-A8F0-394069B9486B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBA0B8A0-6C00-44C2-A8F0-394069B9486B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBA0B8A0-6C00-44C2-A8F0-394069B9486B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,55 @@
@ECHO OFF
SETLOCAL
ECHO SampleEntityDDEXProvider Installation
SET MYDIR=%~dp0
SET RANU=No
SET REGROOT=SOFTWARE\Microsoft\VisualStudio\11.0Exp_Config
SET CODEBASE=
:ParseCmdLine
IF "%1"=="" GOTO Main
IF "%1"=="/ranu" SET RANU=Yes& GOTO NextCmdLine
IF "%1"=="/regroot" IF NOT "%~2"=="" SET REGROOT=%~2& SHIFT & GOTO NextCmdLine
IF "%1"=="/codebase" IF NOT "%~2"=="" SET CODEBASE=%~f2& SHIFT & GOTO NextCmdLine
IF "%1"=="/?" GOTO Help
GOTO Help
:NextCmdLine
SHIFT
GOTO ParseCmdLine
:Main
IF "%CODEBASE%"=="" GOTO Help
ECHO Register as Normal User: %RANU%
ECHO VS Registry Root: %REGROOT%
ECHO Code base: %CODEBASE%
IF NOT EXIST "%CODEBASE%" (
ECHO The code base was not found.
GOTO End
)
IF NOT EXIST "%SystemRoot%\SysWOW64" (
CScript "%MYDIR%\Install.vbs" //NoLogo %RANU% "%REGROOT%" "%CODEBASE%" "regedit"
) ELSE (
CScript "%MYDIR%\Install.vbs" //NoLogo %RANU% "%REGROOT%" "%CODEBASE%" "%SystemRoot%\SysWOW64\regedit"
)
ECHO Done!
GOTO End
:Help
ECHO Usage: install [/ranu] [/regroot ^<regroot^>] /codebase ^<codebase^> [/?]
:End
ENDLOCAL

View File

@@ -0,0 +1,52 @@
Main
Sub Main()
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim fso
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Dim myDir
myDir = fso.GetParentFolderName(WScript.ScriptFullName)
Dim ranu
ranu = WScript.Arguments(0)
Dim regRoot
regRoot = WScript.Arguments(1)
If Right(regRoot, 1) = "\" Then
regRoot = Left(regRoot, Len(regRoot) - 1)
End If
If (ranu = "No") Then
regRoot = "HKEY_LOCAL_MACHINE\" & regRoot
Else
regRoot = "HKEY_CURRENT_USER\" & regRoot
End If
Dim codebase
codebase = WScript.Arguments(2)
Dim regFile
Dim genRegFile
Dim regFileContents
Set regFile = fso.OpenTextFile(myDir & "\ExtendedProvider.reg", 1)
Set genRegFile = fso.CreateTextFile(myDir & "\ExtendedProvider.gen.reg", true)
regFileContents = regFile.ReadAll()
regFileContents = Replace(regFileContents, "%REGROOT%", regRoot)
regFileContents = Replace(regFileContents, "%PROVIDERGUID%", "{E46DFA5C-80A2-4a7a-B6FC-C5D2F67D8690}")
regFileContents = Replace(regFileContents, "%CODEBASE%", Replace(codebase, "\", "\\"))
genRegFile.Write(regFileContents)
genRegFile.Close()
regFile.Close()
Dim oExec
Set oExec = WshShell.Exec(WScript.Arguments(3) & " /s """ & myDir & "\ExtendedProvider.gen.reg""")
Do While oExec.Status = 0
WScript.Sleep(100)
Loop
fso.DeleteFile(myDir & "\ExtendedProvider.gen.reg")
End Sub

View File

@@ -0,0 +1,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>

View File

@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ExtendedProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ExtendedProvider")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f8942188-1fe0-4794-ac4b-e6010f8f34d0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// Unit tests for this assembly need to be able to see internal types
[assembly: InternalsVisibleTo("ExtendedProvider.UnitTests")]

View File

@@ -0,0 +1,153 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17379
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Samples.VisualStudio.Data.ExtendedProvider.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Samples.VisualStudio.Data.ExtendedProvider.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to SQL Server.
/// </summary>
internal static string DataView_SqlServer {
get {
return ResourceManager.GetString("DataView_SqlServer", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Functions.
/// </summary>
internal static string Node_Functions {
get {
return ResourceManager.GetString("Node_Functions", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Stored Procedures.
/// </summary>
internal static string Node_StoredProcedures {
get {
return ResourceManager.GetString("Node_StoredProcedures", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Tables.
/// </summary>
internal static string Node_Tables {
get {
return ResourceManager.GetString("Node_Tables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Types.
/// </summary>
internal static string Node_UserDefinedTypes {
get {
return ResourceManager.GetString("Node_UserDefinedTypes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Users.
/// </summary>
internal static string Node_Users {
get {
return ResourceManager.GetString("Node_Users", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Views.
/// </summary>
internal static string Node_Views {
get {
return ResourceManager.GetString("Node_Views", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This is a sample DDEX provider that uses the SampleEntityFrameworkProvider to connect to instances of Microsoft SQL Server 2005..
/// </summary>
internal static string Provider_Description {
get {
return ResourceManager.GetString("Provider_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sample DDEX provider for SampleEntityFrameworkProvider for SQL Server.
/// </summary>
internal static string Provider_DisplayName {
get {
return ResourceManager.GetString("Provider_DisplayName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to SampleEntityFrameworkProvider (DDEX).
/// </summary>
internal static string Provider_ShortDisplayName {
get {
return ResourceManager.GetString("Provider_ShortDisplayName", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DataView_SqlServer" xml:space="preserve">
<value>SQL Server</value>
</data>
<data name="Node_Functions" xml:space="preserve">
<value>Functions</value>
</data>
<data name="Node_StoredProcedures" xml:space="preserve">
<value>Stored Procedures</value>
</data>
<data name="Node_Tables" xml:space="preserve">
<value>Tables</value>
</data>
<data name="Node_UserDefinedTypes" xml:space="preserve">
<value>Types</value>
</data>
<data name="Node_Users" xml:space="preserve">
<value>Users</value>
</data>
<data name="Node_Views" xml:space="preserve">
<value>Views</value>
</data>
<data name="Provider_Description" xml:space="preserve">
<value>This is a sample DDEX provider that uses the SampleEntityFrameworkProvider to connect to instances of Microsoft SQL Server 2005.</value>
</data>
<data name="Provider_DisplayName" xml:space="preserve">
<value>Sample DDEX provider for SampleEntityFrameworkProvider for SQL Server</value>
</data>
<data name="Provider_ShortDisplayName" xml:space="preserve">
<value>SampleEntityFrameworkProvider (DDEX)</value>
</data>
</root>

View File

@@ -0,0 +1,104 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Data.Services;
using Microsoft.VisualStudio.Data.Framework;
using Microsoft.VisualStudio.Data.Services.SupportEntities;
namespace Microsoft.Samples.VisualStudio.Data.ExtendedProvider
{
/// <summary>
/// Represents a custom data object identifier resolver that correctly
/// expands an identifier to its complete form. This is required for
/// certain built in data design scenarios that are initialized with only
/// a partial identifier and then try to match this identifier with an
/// object from the server.
/// </summary>
internal class SqlObjectIdentifierResolver : DataObjectIdentifierResolver
{
#region Public Methods
/// <summary>
/// SQL Server connections are always within the context of a current
/// database and default schema. This method expands identifiers
/// that are missing database or schema parts by adding the defaults
/// appropriately.
/// </summary>
public override object[] ExpandIdentifier(
string typeName, object[] partialIdentifier)
{
if (typeName == null)
{
throw new ArgumentNullException("typeName");
}
// Find the type in the data object support model
IVsDataObjectType type = null;
IVsDataObjectSupportModel objectSupportModel = Site.GetService(
typeof(IVsDataObjectSupportModel)) as IVsDataObjectSupportModel;
Debug.Assert(objectSupportModel != null);
if (objectSupportModel != null &&
objectSupportModel.Types.ContainsKey(typeName))
{
type = objectSupportModel.Types[typeName];
}
if (type == null)
{
throw new ArgumentException("Invalid type " + typeName + ".");
}
// Create an identifier array of the correct full length
object[] identifier = new object[type.Identifier.Count];
// If the input identifier is not null, copy it to the full
// identifier array. If the input identifier's length is less
// than the full length we assume the more specific parts are
// specified and thus copy into the rightmost portion of the
// full identifier array.
if (partialIdentifier != null)
{
if (partialIdentifier.Length > type.Identifier.Count)
{
throw new ArgumentException("Invalid partial identifier.");
}
partialIdentifier.CopyTo(identifier,
type.Identifier.Count - partialIdentifier.Length);
}
// Get the data source information service
IVsDataSourceInformation sourceInformation =
Site.GetService(typeof(IVsDataSourceInformation))
as IVsDataSourceInformation;
Debug.Assert(sourceInformation != null);
if (sourceInformation == null)
{
// This should never occur
return identifier;
}
// Now expand the identifier as required
if (type.Identifier.Count > 0)
{
// Fill in the current database if not specified
if (!(identifier[0] is string))
{
identifier[0] = sourceInformation[
DataSourceInformation.DefaultCatalog] as string;
}
}
if (type.Identifier.Count > 1)
{
// Fill in the default schema if not specified
if (!(identifier[1] is string))
{
identifier[1] = sourceInformation[
DataSourceInformation.DefaultSchema] as string;
}
}
return identifier;
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace Microsoft.Samples.VisualStudio.Data.ExtendedProvider
{
/// <summary>
/// Represents constant string values for all the supported data object
/// types. This list must be in sync with the data object support XML.
/// </summary>
internal static class SqlObjectTypes
{
public const string Root = "";
public const string User = "User";
public const string Table = "Table";
public const string Column = "Column";
public const string Index = "Index";
public const string IndexColumn = "IndexColumn";
public const string ForeignKey = "ForeignKey";
public const string ForeignKeyColumn = "ForeignKeyColumn";
public const string View = "View";
public const string ViewColumn = "ViewColumn";
public const string StoredProcedure = "StoredProcedure";
public const string StoredProcedureParameter = "StoredProcedureParameter";
public const string StoredProcedureColumn = "StoredProcedureColumn";
public const string Function = "Function";
public const string FunctionParameter = "FunctionParameter";
public const string FunctionColumn = "FunctionColumn";
public const string UserDefinedType = "UserDefinedType";
}
}

View File

@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using System.Data.SqlClient;
using Microsoft.VisualStudio.Data.Services;
using Microsoft.VisualStudio.Data.Framework.AdoDotNet;
namespace Microsoft.Samples.VisualStudio.Data.ExtendedProvider
{
/// <summary>
/// Represents a custom data source information class that is able to
/// provide data source information values that require some form of
/// computation, perhaps based on an active connection.
/// </summary>
internal class SqlSourceInformation : AdoDotNetSourceInformation
{
#region Constructors
public SqlSourceInformation()
{
AddProperty(DefaultSchema);
}
#endregion
#region Protected Methods
/// <summary>
/// RetrieveValue is called once per property that was identified
/// as existing but without a value (specified in the constructor).
/// For the purposes of this sample, only one property needs to be
/// computed - DefaultSchema. To retrieve this value a SQL statement
/// is executed.
/// </summary>
protected override object RetrieveValue(string propertyName)
{
if (propertyName.Equals(DefaultSchema,
StringComparison.OrdinalIgnoreCase))
{
if (Site.State != DataConnectionState.Open)
{
Site.Open();
}
SqlConnection conn = Connection as SqlConnection;
Debug.Assert(conn != null, "Invalid provider object.");
if (conn != null)
{
SqlCommand comm = conn.CreateCommand();
try
{
comm.CommandText = "SELECT SCHEMA_NAME()";
return comm.ExecuteScalar() as string;
}
catch (SqlException)
{
// We let the base class apply default behavior
}
}
}
return base.RetrieveValue(propertyName);
}
#endregion
}
}

View File

@@ -0,0 +1,262 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
***************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
***************************************************************************
-->
<!--
Data view support describes a hierarchical representation of objects using
the information from data object support, which is currently used to drive
the content of the Server/Database Explorer. Presentation information such
as node labels, icons and commands are included in this file.
-->
<DataViewSupport xmlns="http://schemas.microsoft.com/VisualStudio/2007/07/Data/DataViewSupport">
<Views>
<!--
This sample defines a single view. When multiple views are specified,
the end user is able to choose which view is most appropriate for them.
-->
<View name="SQL Server">
<!--
The display name of the view will be shown when the user is picking
between multiple views. This will not occur in this case, but the
display name is included anyway for sample purposes. Notice the
display name is extracted from a resource instead of being hard-coded
in place with this element. The resources for this sample can be
found at the end of this file.
-->
<DisplayName resource="DataView_SqlServer" />
<!--
All views are rooted with a connection node. For this sample, the
connection node is a static node, i.e. it has no underlying object.
-->
<ConnectionNode>
<!--
A connection node must specify an initial display name for the node
(in Server/Database Explorer, the end user can modify connection
node names, hence this is only an initial display name). In this
sample, the display name is based on two properties from the single
root type object instance, specified using DDEX data specifiers.
-->
<InitialDisplayName>{Root.Server}.{Root.Database}.{Root.Schema}</InitialDisplayName>
<!--
Commands can be defined for a node, allowing them to show up on
context menus. The code determining whether or how the command
should show and what happens when the command is invoked is
determined by a command provider associated with each command.
-->
<Commands>
<!--
This command is a built-in command that can launch the Visual
Studio Query Designer to allow building a new query. The command
provider is specified using a COM class ID registered in the
Visual Studio local registry hive.
-->
<Command guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="0x3528" provider="884DD964-5327-461f-9F06-6484DD540F8F" />
</Commands>
<!--
Any node can define one or more children of various types. In this
sample, the children of the connection nodes are a set of static
nodes representing folders that contain instances of the types of
object that have been defined in the data object support XML file.
-->
<Children>
<StaticNode>
<DisplayName resource="Node_Tables" />
<Commands>
<Command guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="0x3528" provider="884DD964-5327-461f-9F06-6484DD540F8F" />
</Commands>
<Children>
<!--
The children for this node are a selection of table objects.
This is specified using a Selection element with information
defining the appropriate call to be made to the data object
store. For this sample, this means passing "Table" as the
type and null for each restriction except the type
restriction, which is "BASE TABLE".
-->
<Selection type="Table" restrictions="null,null,null,BASE TABLE">
<!--
A given selection also defines the characteristics for each
object node that is returned as part of the selection. In
this case, the SelectionNode element defines how to present
a table object. Each table node is given a node ID which
is used by table node children to request properties from
the parent table node.
-->
<SelectionNode nodeId="Table">
<!--
Since the root object now provides default schema metadata
we can add a condition to the display name of top level
objects so it only shows the schema when it is a
non-default schema.
-->
<DisplayName when="NOT ({Schema} = {Root.Schema})" resource="Node_ObjectWithSchema" />
<!--
Icons can be picked from a pre-existing set based on name
or from a custom resource, or using an icon provider.
This sample simply chooses "Table" from the existing set.
-->
<Icon name="Table" />
<Commands>
<!--
This command supplies an ability to launch the Visual
Studio Query Designer prepopulated with the results of
retrieving data from this table. A requirement for this
command to work is the ability to build a DSRef object
from the underlying table object instance, as defined
by including the IDSRefBuilder service for this type in
the data object support XML file.
-->
<Command guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="0x3060" provider="884DD964-5327-461f-9F06-6484DD540F8F" />
</Commands>
<Children>
<!--
Each table node contains the set of columns that are in
that table. This is defined with another selection
with specific restrictions to ensure only columns for
the appropriate table is returned. The node ID defined
on the parent table node is used to access properties
of the table object using DDEX data specifiers.
-->
<Selection type="Column" restrictions="{Table.Database},{Table.Schema},{Table.Name}">
<SelectionNode>
<Icon name="Column" />
</SelectionNode>
</Selection>
</Children>
</SelectionNode>
</Selection>
</Children>
</StaticNode>
<StaticNode>
<DisplayName resource="Node_Views" />
<Commands>
<Command guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="0x3528" provider="884DD964-5327-461f-9F06-6484DD540F8F" />
</Commands>
<Children>
<Selection type="View">
<SelectionNode nodeId="View">
<DisplayName when="NOT ({Schema} = {Root.Schema})" resource="Node_ObjectWithSchema" />
<Icon name="View" />
<Commands>
<Command guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="0x3060" provider="884DD964-5327-461f-9F06-6484DD540F8F" />
</Commands>
<Children>
<Selection type="ViewColumn" restrictions="{View.Database},{View.Schema},{View.Name}">
<SelectionNode>
<Icon name="Column" />
</SelectionNode>
</Selection>
</Children>
</SelectionNode>
</Selection>
</Children>
</StaticNode>
<StaticNode>
<DisplayName resource="Node_StoredProcedures" />
<Children>
<Selection type="StoredProcedure" restrictions="{Root.Database}">
<SelectionNode nodeId="StoredProcedure">
<DisplayName when="NOT ({Schema} = {Root.Schema})" resource="Node_ObjectWithSchema" />
<Icon name="StoredProcedure" />
<Children>
<Selection type="StoredProcedureParameter" restrictions="{StoredProcedure.Database},{StoredProcedure.Schema},{StoredProcedure.Name}">
<SelectionNode>
<!--
The following element illustrates how it is possible
to choose a different name based on object data.
When the expression here evaluates to false, the
default display name will be used.
-->
<DisplayName when="{Ordinal} = 0">@RETURN_VALUE</DisplayName>
<!--
The following elements illustrate how it is possible
to choose a different icon based on object data.
-->
<Icon when="{Ordinal} = 0" name="ReturnValue" />
<Icon when="{IsOutput} = false" name="InputParameter" />
<Icon when="{IsOutput} = true" name="OutputParameter" />
</SelectionNode>
</Selection>
<Selection type="StoredProcedureColumn" restrictions="{StoredProcedure.Database},{StoredProcedure.Schema},{StoredProcedure.Name}">
<SelectionNode>
<Icon name="Column" />
</SelectionNode>
</Selection>
</Children>
</SelectionNode>
</Selection>
</Children>
</StaticNode>
<StaticNode>
<DisplayName resource="Node_Functions" />
<Children>
<Selection type="Function" restrictions="{Root.Database}">
<SelectionNode nodeId="Function">
<DisplayName when="NOT ({Schema} = {Root.Schema})" resource="Node_ObjectWithSchema" />
<Icon when="{Type} IN ('FN', 'FS')" name="ScalarFunction" />
<Icon when="{Type} IN ('FT', 'IF', 'TF')" name="TabularFunction" />
<Icon when="{Type} IN ('AF')" name="AggregateFunction" />
<Children>
<Selection type="FunctionParameter" restrictions="{Function.Database},{Function.Schema},{Function.Name}">
<SelectionNode>
<Icon when="{Ordinal} = 0" name="ReturnValue" />
<Icon when="{IsOutput} = false" name="InputParameter" />
<Icon when="{IsOutput} = true" name="OutputParameter" />
</SelectionNode>
</Selection>
<Selection type="FunctionColumn" restrictions="{Function.Database},{Function.Schema},{Function.Name}">
<SelectionNode>
<Icon name="Column" />
</SelectionNode>
</Selection>
</Children>
</SelectionNode>
</Selection>
</Children>
</StaticNode>
<!--
Just as the data object support XML file can specify minimum or
maximum data source versions for elements, the data view support
XML file can filter the same way, ensuring only the correct nodes
for the correct data source version show up. In this case, user
defined types should not be shown unless the version is 9 or more.
-->
<StaticNode minSourceVersion="09">
<DisplayName resource="Node_UserDefinedTypes" />
<Children>
<Selection type="UserDefinedType">
<SelectionNode>
<Icon name="DataType" />
</SelectionNode>
</Selection>
</Children>
</StaticNode>
<StaticNode>
<DisplayName resource="Node_Users" />
<Children>
<Selection type="User" />
</Children>
</StaticNode>
</Children>
</ConnectionNode>
</View>
</Views>
<!--
This section identifies strings that can be referenced from any place in
this file. Specifying the baseName attribute indicates a resource in the
sample assembly that contains localized strings. Any strings specified
directly here are simply for sharing purposes and are not localized.
-->
<Resources baseName="Microsoft.Samples.VisualStudio.Data.ExtendedProvider.Properties.Resources">
<Resource name="Node_ObjectWithSchema">{Name} ({Schema})</Resource>
</Resources>
</DataViewSupport>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.data>
<DbProviderFactories>
<clear />
<add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add name="Sample Entity Framework Provider" invariant="SampleEntityFrameworkProvider" description="Sample Entity Framework Provider" type="SampleEntityFrameworkProvider.SampleFactory, SampleEntityFrameworkProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=095b6aea3a01b8e0" />
</DbProviderFactories>
</system.data>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>

Some files were not shown because too many files have changed in this diff Show More