private static void CheckOutputFiles( IScaffoldingCodeGenerator codeGenerator, string outputPath, string dbContextClassName, IModel metadataModel, bool overwriteFiles) { var readOnlyFiles = codeGenerator.GetReadOnlyFilePaths( outputPath, dbContextClassName, metadataModel.GetEntityTypes()); if (readOnlyFiles.Count > 0) { throw new InvalidOperationException( DesignStrings.ReadOnlyFiles( outputPath, string.Join( CultureInfo.CurrentCulture.TextInfo.ListSeparator, readOnlyFiles))); } if (!overwriteFiles) { var existingFiles = codeGenerator.GetExistingFilePaths( outputPath, dbContextClassName, metadataModel.GetEntityTypes()); if (existingFiles.Count > 0) { throw new InvalidOperationException( DesignStrings.ExistingFiles( outputPath, string.Join( CultureInfo.CurrentCulture.TextInfo.ListSeparator, existingFiles))); } } }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public ReverseEngineerScaffolder( IDatabaseModelFactory databaseModelFactory, IScaffoldingModelFactory scaffoldingModelFactory, IScaffoldingCodeGenerator scaffoldingCodeGenerator, ICSharpUtilities cSharpUtilities) { _databaseModelFactory = databaseModelFactory ?? throw new ArgumentNullException(nameof(databaseModelFactory)); _factory = scaffoldingModelFactory ?? throw new ArgumentNullException(nameof(scaffoldingModelFactory)); ScaffoldingCodeGenerator = scaffoldingCodeGenerator ?? throw new ArgumentNullException(nameof(scaffoldingCodeGenerator)); _cSharpUtilities = cSharpUtilities ?? throw new ArgumentNullException(nameof(cSharpUtilities)); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public ModelScaffolder( [NotNull] IScaffoldingModelFactory scaffoldingModelFactory, [NotNull] IScaffoldingCodeGenerator scaffoldingCodeGenerator, [NotNull] ICSharpUtilities cSharpUtilities) { Check.NotNull(scaffoldingModelFactory, nameof(scaffoldingModelFactory)); Check.NotNull(scaffoldingCodeGenerator, nameof(scaffoldingCodeGenerator)); _factory = scaffoldingModelFactory; ScaffoldingCodeGenerator = scaffoldingCodeGenerator; _cSharpUtilities = cSharpUtilities; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public ReverseEngineerScaffolder( [NotNull] IDatabaseModelFactory databaseModelFactory, [NotNull] IScaffoldingModelFactory scaffoldingModelFactory, [NotNull] IScaffoldingCodeGenerator scaffoldingCodeGenerator, [NotNull] ICSharpUtilities cSharpUtilities) { Check.NotNull(databaseModelFactory, nameof(databaseModelFactory)); Check.NotNull(scaffoldingModelFactory, nameof(scaffoldingModelFactory)); Check.NotNull(scaffoldingCodeGenerator, nameof(scaffoldingCodeGenerator)); _databaseModelFactory = databaseModelFactory; _factory = scaffoldingModelFactory; ScaffoldingCodeGenerator = scaffoldingCodeGenerator; _cSharpUtilities = cSharpUtilities; }