/// <summary> /// Obtains the and set entity assembly namespaces. /// </summary> /// <param name="cxInfo">The cx info.</param> private void ObtainAndSetEntityAssemblyNamespaces(IConnectionInfo cxInfo) { var entityAssemblyFilename = CxInfoHelper.GetEntityAssemblyFilename(cxInfo, CxInfoHelper.GetTemplateGroup(cxInfo)); if (string.IsNullOrEmpty(entityAssemblyFilename)) { return; } var assembly = DataContextDriver.LoadAssemblySafely(entityAssemblyFilename); var namespaces = assembly.GetTypes().Select(t => t.Namespace).Distinct().ToArray(); CxInfoHelper.SetDriverDataElement(cxInfo, DriverDataElements.EntityAssemblyNamespacesElement, String.Join(",", namespaces)); }
/// <summary> /// Fills the cx info with the data specified on the form /// </summary> private void FillCxInfo() { if (_cxInfo == null) { return; } _cxInfo.AppConfigPath = _appConfigFileTextBox.Text.Trim(); var templateGroupSelected = _selfServicingRadioButton.Checked?TemplateGroup.SelfServicing : TemplateGroup.Adapter; CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.TemplateGroupElement, XmlConvert.ToString((int)templateGroupSelected)); CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.AdapterDBGenericAssemblyFilenameElement, _aGenAssemblyTextBox.Text); CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.AdapterDBSpecificAssemblyFilenameElement, _aSpecAssemblyTextBox.Text); CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.SelfServicingAssemblyFilenameElement, _ssAssemblyTextBox.Text); CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.ConfigFileFilenameElement, _appConfigFileTextBox.Text); CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.ConnectionStringElementName, _connectionStringTextBox.Text); _cxInfo.DatabaseInfo.CustomCxString = _connectionStringTextBox.Text; CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.EnableORMProfilerElement, XmlConvert.ToString((_enableORMProfilerCheckBox.Enabled && _enableORMProfilerCheckBox.Checked))); CxInfoHelper.SetCustomTypeInfo(_cxInfo, templateGroupSelected); }
/// <summary> /// Enables the disable ORM profiler check box. /// </summary> private void EnableDisableORMProfilerCheckBox() { // check whether the .opsnapshot extension is registered in the registry. If so, grab the folder location for the interceptor. // if not, disable the checkbox. bool enableEnableORMProfilerCheckbox = true; var opsnapshotRegistration = Registry.GetValue("HKEY_CLASSES_ROOT\\.opsnapshot", string.Empty, null); if (opsnapshotRegistration == null) { enableEnableORMProfilerCheckbox = false; } else { string realRegistryKey = opsnapshotRegistration as string; if (realRegistryKey == null) { enableEnableORMProfilerCheckbox = false; } else { var iconPath = Registry.GetValue(string.Format("HKEY_CLASSES_ROOT\\{0}\\DefaultIcon", realRegistryKey), string.Empty, null) as string; if (iconPath == null) { enableEnableORMProfilerCheckbox = false; } else { iconPath = iconPath.Substring(0, iconPath.Length - 2); var interceptorPath = Path.Combine(Path.GetDirectoryName(iconPath), "SD.Tools.OrmProfiler.Interceptor.dll"); enableEnableORMProfilerCheckbox = File.Exists(interceptorPath); if (enableEnableORMProfilerCheckbox) { CxInfoHelper.SetDriverDataElement(_cxInfo, DriverDataElements.ORMProfilerInterceptorLocationElement, interceptorPath); } } } } _enableORMProfilerCheckBox.Enabled = enableEnableORMProfilerCheckbox; }