Ejemplo n.º 1
0
        public IDataSchemaProcedure GetProcedureOrFunction(string schemaName, string objectName)
        {
            IDataSchemaProcedure procedureOrFunction = null;

            if (!string.IsNullOrEmpty(schemaName) &&
                !string.IsNullOrEmpty(objectName))
            {
                var procedureList =
                    _selector.SelectMappedObjects <IVsDataStoredProcedure>(new object[] { DefaultCatalog, schemaName, objectName }, true);
                if (procedureList.Count > 0)
                {
                    procedureOrFunction = new DataSchemaProcedure(this, procedureList[0]);
                }
                else
                {
                    var functionList =
                        _selector.SelectMappedObjects <IVsDataScalarFunction>(new object[] { DefaultCatalog, schemaName, objectName }, true);
                    if (functionList.Count > 0)
                    {
                        procedureOrFunction = new DataSchemaProcedure(this, functionList[0]);
                    }
                    else
                    {
                        var tvfList =
                            _selector.SelectMappedObjects <IVsDataTabularFunction>(
                                new object[] { DefaultCatalog, schemaName, objectName }, true);
                        if (tvfList.Count > 0)
                        {
                            procedureOrFunction = new DataSchemaProcedure(this, tvfList[0]);
                        }
                    }
                }
            }

            return(procedureOrFunction);
        }
Ejemplo n.º 2
0
 internal CreateMatchingFunctionImportCommand(IDataSchemaProcedure schemaProcedure, bool shouldCreateMatchingFunctionImport)
 {
     Initialize(schemaProcedure);
     _shouldCreateComposableFunctionImport = shouldCreateMatchingFunctionImport;
 }
Ejemplo n.º 3
0
 internal CreateMatchingFunctionImportCommand(IDataSchemaProcedure schemaProcedure)
 {
     Initialize(schemaProcedure);
 }
        internal NewFunctionImportDialog(
            Function baseFunction,
            string functionImportName,
            ICollection<Function> functions,
            IEnumerable<ComplexType> complexTypes,
            IEnumerable<EntityType> entityTypes,
            ConceptualEntityContainer container,
            object selectedElement)
        {
            // The dialog 3 mode:
            // - New function import: to create a new function import
            // - Full edit function import: the dialog is launched from model browser; all fields are editable
            _mode = DialogMode.New;
            _editedFunctionImport = container.FunctionImports().Where(x => x.LocalName.Value == functionImportName).FirstOrDefault();
            if (_editedFunctionImport != null)
            {
                _mode = DialogMode.FullEdit;
            }
            _functions = functions;
            _lastGeneratedStoredProc = null;
            _container = container;
            _updateSelectedComplexType = false;
            InitializeSupportedFeatures();
            InitializeComponent();
            InitializeDialogFont();

            // set tooltip on functionImportComposableCheckBox if not supported
            if (false == _composableFunctionImportFeatureState.IsEnabled())
            {
                var isComposableToolTipMsg = string.Format(
                    CultureInfo.CurrentCulture, DialogsResource.NewFunctionImportDialog_IsComposableTooltipText,
                    EntityFrameworkVersion.Version2);
                var isComposableToolTip = new ToolTip();
                isComposableToolTip.ShowAlways = true; // show even if control inactive
                isComposableToolTip.SetToolTip(functionImportComposableCheckBox, isComposableToolTipMsg);
            }

            // once the components are initialized, check the functionImportComposableCheckBox if appropriate
            if (_composableFunctionImportFeatureState.IsEnabled())
            {
                if (DialogMode.FullEdit == _mode)
                {
                    functionImportComposableCheckBox.Checked = (BoolOrNone.TrueValue == _editedFunctionImport.IsComposable.Value);
                }
                else
                {
                    Debug.Assert(_mode == DialogMode.New, "Unexpected mode");

                    functionImportComposableCheckBox.Checked = baseFunction != null && baseFunction.IsComposable.Value;
                }
            }

            // Hide the Update button/GetColumnInformation frame if this functionality isn't allowed
            if (!_getColumnInformationFeatureState.IsVisible())
            {
                updateComplexTypeButton.Visible = false;
                returnTypeShapeGroup.Visible = false;
                if (ClientSize.Height > returnTypeShapeGroup.Height)
                {
                    var newSize = new Size(Size.Width, Size.Height - returnTypeShapeGroup.Height);
                    MinimumSize = newSize;
                    Size = newSize;
                }
            }

            PopulateComboBoxes(complexTypes, entityTypes, functions);
            UpdateStateComboBoxes(selectedElement, baseFunction, functionImportName);
            SetComplexTypeTooltip();
            CheckOkButtonEnabled();
            UpdateReturnTypeComboBoxesState();
            UpdateReturnTypeInfoAreaState();
            SetCreateNewComplexTypeButtonProperties();

            if (components == null)
            {
                components = new Container();
            }
            // Since Visual Studio has already defined Dispose method in the generated file(designer.cs),
            // we instantiates Diposer class that calls our custom dispose method when Form is disposed.
            components.Add(new Disposer(OnDispose));
        }
 internal CreateMatchingFunctionImportCommand(IDataSchemaProcedure schemaProcedure, bool shouldCreateMatchingFunctionImport)
 {
     Initialize(schemaProcedure);
     _shouldCreateComposableFunctionImport = shouldCreateMatchingFunctionImport;
 }
 internal CreateMatchingFunctionImportCommand(IDataSchemaProcedure schemaProcedure)
 {
     Initialize(schemaProcedure);
 }