protected override bool LaunchEntityDesignerWizard(EdmDataSourceWizardData wizardData)
        {
            var containingProject = wizardData.ContainingProject;
            var itemTemplatePath  = GetEdmxItemTemplatePath(containingProject);
            var edmxFileName      = GetUniqueEdmxFileNameInProject(containingProject, Resources.EdmDesignerFileNameFormat);

            try
            {
                containingProject.ProjectItems.AddFromTemplate(itemTemplatePath, edmxFileName);
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == VSConstants.OLE_E_PROMPTSAVECANCELLED)
                {
                    // replace COMException indicating that the user cancelled the Entity Designer Wizard with
                    // a WizardCancelledException
                    throw new WizardCancelledException();
                }
                else
                {
                    throw;
                }
            }

            wizardData.EDMProjectItem = VsUtils.GetProjectItemForDocument(edmxFileName, WizardForm.ServiceProvider);
            // Dismiss Data Source Wizard if a new edmx file is successfuly created.
            return(wizardData.EDMProjectItem != null);
        }
        protected override bool LaunchEntityDesignerWizard(EdmDataSourceWizardData wizardData)
        {
            var containingProject = wizardData.ContainingProject;
            var itemTemplatePath = GetEdmxItemTemplatePath(containingProject);
            var edmxFileName = GetUniqueEdmxFileNameInProject(containingProject, Resources.EdmDesignerFileNameFormat);
            try
            {
                containingProject.ProjectItems.AddFromTemplate(itemTemplatePath, edmxFileName);
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == VSConstants.OLE_E_PROMPTSAVECANCELLED)
                {
                    // replace COMException indicating that the user cancelled the Entity Designer Wizard with
                    // a WizardCancelledException
                    throw new WizardCancelledException();
                }
                else
                {
                    throw;
                }
            }

            wizardData.EDMProjectItem = VsUtils.GetProjectItemForDocument(edmxFileName, WizardForm.ServiceProvider);
            // Dismiss Data Source Wizard if a new edmx file is successfuly created.
            return (wizardData.EDMProjectItem != null);
        }
Example #3
0
        /// <summary>
        ///     Create a data bucket to hold data collected by the wizard engine.
        ///     This is called when the user selects Add New Data Source menu item
        /// </summary>
        /// <param name="wizardForm"></param>
        /// <param name="referencedItem"></param>
        /// <param name="targetCollection"></param>
        /// <returns></returns>
        IDataSourceWizardData IDataSourceWizardEngine.CreateData(
            DataSourceWizardFormBase wizardForm, ProjectItem referencedItem, ProjectItems targetCollection)
        {
            Debug.Assert(wizardForm != null, "Wizard form is null!");
            Debug.Assert(wizardForm.Project != null, "Could not determine the current project");

            var data = new EdmDataSourceWizardData
            {
                ContainingProject = wizardForm.Project,
            };

            return(data);
        }
Example #4
0
        /// <summary>
        ///     Create a data bucket to hold data collected by the wizard engine.
        ///     This is called when the user selects Update Data Source menu item.
        /// </summary>
        /// <param name="wizardForm"></param>
        /// <param name="targetItem"></param>
        /// <returns></returns>
        IDataSourceWizardData IDataSourceWizardEngine.CreateData(DataSourceWizardFormBase wizardForm, ProjectItem targetItem)
        {
            Debug.Assert(wizardForm != null, "Wizard form is null");
            Debug.Assert(wizardForm.Project != null, "Could not determine the current project");
            Debug.Assert(targetItem != null, "the passed in targetItem is null");

            var data = new EdmDataSourceWizardData
            {
                ContainingProject = wizardForm.Project,
                EDMProjectItem    = targetItem
            };

            return(data);
        }
Example #5
0
 protected override bool LaunchEntityDesignerWizard(EdmDataSourceWizardData wizardData)
 {
     Debug.Assert(wizardData.EDMProjectItem != null, "EDMProjectItem is null");
     if (wizardData.EDMProjectItem != null)
     {
         // We need to ensure that the edmx is opened in the designer.
         var window = wizardData.EDMProjectItem.Open(Constants.vsViewKindPrimary);
         Debug.Assert(window != null, "Unable to get window for created edmx file");
         if (window != null)
         {
             window.Activate();
         }
         DoLaunchUpdateModelFromDatabaseWizard(wizardData.EDMProjectItem);
     }
     // always dismiss the DataSource Wizard.
     return(true);
 }
 protected override bool LaunchEntityDesignerWizard(EdmDataSourceWizardData wizardData)
 {
     Debug.Assert(wizardData.EDMProjectItem != null, "EDMProjectItem is null");
     if (wizardData.EDMProjectItem != null)
     {
         // We need to ensure that the edmx is opened in the designer.
         var window = wizardData.EDMProjectItem.Open(Constants.vsViewKindPrimary);
         Debug.Assert(window != null, "Unable to get window for created edmx file");
         if (window != null)
         {
             window.Activate();
         }
         DoLaunchUpdateModelFromDatabaseWizard(wizardData.EDMProjectItem);
     }
     // always dismiss the DataSource Wizard.
     return true;
 }
        /// <summary>
        ///     Create a data bucket to hold data collected by the wizard engine.
        ///     This is called when the user selects Update Data Source menu item.
        /// </summary>
        /// <param name="wizardForm"></param>
        /// <param name="targetItem"></param>
        /// <returns></returns>
        IDataSourceWizardData IDataSourceWizardEngine.CreateData(DataSourceWizardFormBase wizardForm, ProjectItem targetItem)
        {
            Debug.Assert(wizardForm != null, "Wizard form is null");
            Debug.Assert(wizardForm.Project != null, "Could not determine the current project");
            Debug.Assert(targetItem != null, "the passed in targetItem is null");

            var data = new EdmDataSourceWizardData
                {
                    ContainingProject = wizardForm.Project,
                    EDMProjectItem = targetItem
                };
            return data;
        }
        /// <summary>
        ///     Create a data bucket to hold data collected by the wizard engine.
        ///     This is called when the user selects Add New Data Source menu item
        /// </summary>
        /// <param name="wizardForm"></param>
        /// <param name="referencedItem"></param>
        /// <param name="targetCollection"></param>
        /// <returns></returns>
        IDataSourceWizardData IDataSourceWizardEngine.CreateData(
            DataSourceWizardFormBase wizardForm, ProjectItem referencedItem, ProjectItems targetCollection)
        {
            Debug.Assert(wizardForm != null, "Wizard form is null!");
            Debug.Assert(wizardForm.Project != null, "Could not determine the current project");

            var data = new EdmDataSourceWizardData
                {
                    ContainingProject = wizardForm.Project,
                };

            return data;
        }
Example #9
0
 protected abstract bool LaunchEntityDesignerWizard(EdmDataSourceWizardData wizardData);
 protected abstract bool LaunchEntityDesignerWizard(EdmDataSourceWizardData wizardData);