src/Misc/EFTools/EntityDesignDataSourceWizardExtension/LaunchModelGenWizardPage.cs
/// <summary>
///     Generate a unique project item name
/// </summary>
Generate a unique project item name
Generate a unique project item name
private static string GetUniqueEdmxFileNameInProject(Project project, string formatModelName)
        {
            const int numberMaxTries = 100000;
            var rootDirectory = VsUtils.GetProjectRoot(project, Services.ServiceProvider);
            var generatedModelName = String.Empty;
            for (var i = 1; i < numberMaxTries; i++)
            {
                generatedModelName = String.Format(CultureInfo.CurrentCulture, formatModelName, i);
                if (!File.Exists(rootDirectory.FullName + "\\" + generatedModelName))
                {
                    return generatedModelName;
                }
            }
            Debug.Assert(false, "Could not generated unique project item name.");
            return generatedModelName;
        }
private static string GetUniqueEdmxFileNameInProject ( Project project , string formatModelName ) { const int numberMaxTries = 100000 ; var rootDirectory = VsUtils . GetProjectRoot ( project , Services . ServiceProvider ) ; var generatedModelName = String . Empty ; for ( var i = 1 ; i < numberMaxTries ; i ++ ) { generatedModelName = String . Format ( CultureInfo . CurrentCulture , formatModelName , i ) ; if ( ! File . Exists ( rootDirectory . FullName + " \\ " + generatedModelName ) ) { return generatedModelName ; } } Debug . Assert ( false , " " ) ; return generatedModelName ; }
Generate a unique project item name
Generate a unique project item name
// The edmx will always be added under root folder.
project
Project
formatModelName
string