コード例 #1
0
        public static void RegisterDdexProviders()
        {
            //TODO Consider removing this
            try
            {
                var ver = SqlCeToolboxPackage.VisualStudioVersion.ToString(1);

                if (SqlCeToolboxPackage.VisualStudioVersion >= new Version(12, 0))
                {
                    DdexRegistry.AddDdex4Registrations(ver);
                }
            }
            catch (Exception ex)
            {
                SendError(ex, DatabaseType.SQLServer);
            }
        }
コード例 #2
0
        private static void RegisterDdex4Provider(bool force)
        {
            string ver = SqlCeToolboxPackage.VisualStudioVersion.ToString(1);

            try
            {
                if (force)
                {
                    DdexRegistry.AddDdex4Registrations(ver);
                }
                else
                {
                    //Check if provider keys exists
                    using (var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32))
                    {
                        var ddexKey = key.OpenSubKey(string.Format(@"SOFTWARE\Microsoft\VisualStudio\{0}.0_Config\DataProviders\{{673BE80C-CB41-47A7-B0F3-9872B6DDE5E5}}", ver));
                        if (ddexKey == null)
                        {
                            DdexRegistry.AddDdex4Registrations(ver);
                        }
                    }
                }
                var ddexDllPath = DdexDllPath(Ddex40Dll);
                if (!string.IsNullOrEmpty(ddexDllPath))
                {
                    Registry.SetValue(
                        string.Format(
                            @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\{0}.0_Config\DataProviders\{{673BE80C-CB41-47A7-B0F3-9872B6DDE5E5}}",
                            ver),
                        "Codebase",
                        ddexDllPath,
                        RegistryValueKind.String);
                }
            }
            catch (Exception ex)
            {
                SendError(ex, DatabaseType.SQLServer);
            }
        }