src/Misc/EFTools/EntityDesign/VisualStudio/ModelWizard/ModelObjectItemWizard.cs
// <summary>
//     Returns the folder path for the selected item (project or folder) that we are adding new items into
// </summary>
Returns the folder path for the selected item (project or folder) that we are adding new items into
Returns the folder path for the selected item ( project or folder ) that we are adding new items into
private static string GetFolderNameForNewItems(DTE2 dte, Project activeProject)
        {
            var selectedItems = dte.SelectedItems;
            var selectedItem = selectedItems.Item(1);
            string path;
            if (selectedItem.Project != null)
            {
                var di = VsUtils.GetProjectRoot(selectedItem.Project, Services.ServiceProvider);
                path = di.FullName;
            }
            else if (selectedItem.ProjectItem != null)
            {
                var pi = selectedItem.ProjectItem;
                path = pi.FileNames[1];
                var di = new DirectoryInfo(path);
                while ((di.Attributes & FileAttributes.Directory) == 0)
                {
                    di = di.Parent;
                }
                path = di.FullName;
            }
            else
            {
                var di = VsUtils.GetProjectRoot(activeProject, Services.ServiceProvider);
                path = di.FullName;
            }
            if (VsUtils.IsWebSiteProject(activeProject))
            {
                var di = new DirectoryInfo(
                    Path.Combine(
                        VsUtils.GetProjectRoot(activeProject, Services.ServiceProvider).FullName,
                        EdmUtils.AppCodeFolderName));
                if (!path.StartsWith(di.FullName, StringComparison.OrdinalIgnoreCase))
                {
                    path = di.FullName;
                }
            }
            return path;
        }
private static string GetFolderNameForNewItems ( DTE2 dte , Project activeProject ) { var selectedItems = dte . SelectedItems ; var selectedItem = selectedItems . Item ( 1 ) ; string path ; if ( selectedItem . Project != null ) { var di = VsUtils . GetProjectRoot ( selectedItem . Project , Services . ServiceProvider ) ; path = di . FullName ; } else if ( selectedItem . ProjectItem != null ) { var pi = selectedItem . ProjectItem ; path = pi . FileNames [ 1 ] ; var di = new DirectoryInfo ( path ) ; while ( ( di . Attributes & FileAttributes . Directory ) == 0 ) { di = di . Parent ; } path = di . FullName ; } else { var di = VsUtils . GetProjectRoot ( activeProject , Services . ServiceProvider ) ; path = di . FullName ; } if ( VsUtils . IsWebSiteProject ( activeProject ) ) { var di = new DirectoryInfo ( Path . Combine ( VsUtils . GetProjectRoot ( activeProject , Services . ServiceProvider ) . FullName , EdmUtils . AppCodeFolderName ) ) ; if ( ! path . StartsWith ( di . FullName , StringComparison . OrdinalIgnoreCase ) ) { path = di . FullName ; } } return path ; }
Returns the folder path for the selected item (project or folder) that we are adding new items into
Returns the folder path for the selected item ( project or folder ) that we are adding new items into
// if more than one folder is selected, the wizard framework adds items into the first (index 1)  // path in the list. // if this is a website project, then the path must start with App_Code.  If not, then we will strip  // off all other paths and replace them with App_Code.  This is because the wizard will place EDMX files // into the root of App_Code if you try to add them in another folder.  For example, if you try to add an EDMX  // files into "projectRoot\XXX\YYY", the wizard will pop a dialog and add it into App_Code.
dte
DTE2
activeProject
Project