internal static void ScaffoldReadMe(this EntityFrameworkCoreProject project) { var lines = new List <string> { "CatFactory: Scaffolding Made Easy", string.Empty, "How to use this code on your ASP.NET Core Application:", string.Empty, "1. Install EntityFrameworkCore.SqlServer package", string.Empty, "2. Register your DbContext and repositories in ConfigureServices method (Startup class):", string.Format(" services.AddDbContext<{0}>(options => options.UseSqlServer(\"ConnectionString\"));", project.GetDbContextName(project.Database)), " services.AddScoped<IDboRepository, DboRepository>();", string.Empty, "Happy scaffolding!", string.Empty, "You can check the guide for this package in:", "https://www.codeproject.com/Articles/1160615/Scaffolding-Entity-Framework-Core-with-CatFactory", string.Empty, "Also you can check source code on GitHub:", "https://github.com/hherzl/CatFactory.EntityFrameworkCore", string.Empty, "CatFactory Development Team ==^^==" }; File.WriteAllText(Path.Combine(project.OutputDirectory, "CatFactory.EntityFrameworkCore.ReadMe.txt"), lines.ToStringBuilder().ToString()); }
internal static void ScaffoldMdReadMe(this EntityFrameworkCoreProject project) { var readMe = new MdDocument(); readMe.H1("CatFactory ==^^==: Scaffolding Made Easy"); readMe.WriteLine("How to use this code on your ASP.NET Core Application:"); readMe.OrderedList( "Install EntityFrameworkCore.SqlServer package", "Register the DbContext and Repositories in ConfigureServices method (Startup class)" ); readMe.H2("Install package"); readMe.WriteLine("You can install the NuGet packages in Visual Studio or Windows Command Line, for more info:"); readMe.WriteLine( Md.Link("Install and manage packages with the Package Manager Console in Visual Studio (PowerShell)", "https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-powershell") ); readMe.WriteLine( Md.Link(".NET Core CLI", "https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-add-package") ); readMe.H2("Register DbContext and Repositories"); readMe.WriteLine("Add the following code lines in {0} method (Startup class):", Md.Bold("ConfigureServices")); readMe.WriteLine(" services.AddDbContext<{0}>(options => options.UseSqlServer(\"ConnectionString\"));", project.GetDbContextName(project.Database)); readMe.WriteLine(" services.AddScope<{0}, {1}>()", "IDboRepository", "DboRepository"); readMe.WriteLine("Happy scaffolding!"); var codeProjectLink = Md.Link("Scaffolding Entity Framework Core with CatFactory", "https://www.codeproject.com/Articles/1160615/Scaffolding-Entity-Framework-Core-with-CatFactory"); readMe.WriteLine("You can check the guide for this package in: {0}", codeProjectLink); var gitHubRepositoryLink = Md.Link("GitHub repository", "https://github.com/hherzl/CatFactory.EntityFrameworkCore"); readMe.WriteLine("Also you can check the source code on {0}", gitHubRepositoryLink); readMe.WriteLine("CatFactory Development Team ==^^=="); File.WriteAllText(Path.Combine(project.OutputDirectory, "CatFactory.EntityFrameworkCore.ReadMe.MD"), readMe.ToString()); }