Skip to content

Patrick-Dolan/cSharpDevEnvTemplate-WebDBIdentity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

{Application name here}

By {List of contributors}

{Brief description of application}

Technologies Used

  • C#
  • .NET 5.0
  • dotnet
  • MySql/Workbench

Description

{This is a detailed description of your application. Give as much detail as needed to explain what the application does as well as any other information you want users or other developers to have.}

Setup/Installation Requirements

  • Make sure you have MySql Workbench installed on your computer.
  • Make sure to have dotnet-ef installed too.
    This project uses dotnet-ef --version 3.0.0 which I have globally installed but you can install it however you want.
  • Download repo to your computer using either clone or the download link.
  • Open the project in VScode or your terminal/IDE of choice.
  • Create a appsettings.json file in the root directory of the project folder. And add the following code replacing anything in square brackets with the information it represents specific to the project database:
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Port=3306;database=[DATABASE-NAME-HERE];uid=[USER-ID-HERE];pwd=[YOUR-PASSWORD-HERE];"
  }
}

Example of complete appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Port=3306;database=to_do_list;uid=root;pwd=MySuperStrongPassword;"
  }
}

  • Make sure to run your mysql server and open MySql workbench.
  • Open MySql Workbench and login to your server.
  • From your terminal navigate to the ProjectName/ folder and run the command dotnet ef database update to create the database from migrations.
  • Now using your IDE navigate into the ProjectName.Solution/ProjectName folder and use the command dotnet run to launch the program.
  • The site should be available at the server address you used in the appsettings.json folder.
  • Now using your IDE in the ProjectName.Solution/ProjectName/ folder use the command dotnet run to launch the program.
  • The site should be available at the server address you used in the appsettings.json folder.

Test Setup/Installation

  • Open the repo on your editor of choice/terminal
  • Navigate to ProjectName.Tests directory in your terminal
  • Run the following command to setup testing:
    dotnet restore
  • Run tests by going to the test project in the terminal (ProjectName.Solution/ProjectName.Tests) and running the following command:
    dotnet test

    --TEMPLATE INSTRUCTIONS DELETE FOLLOWING AFTER SETUP--
    Resource on how to build/use this template
  • In Startup.cs change ProjectName for database class name in configurationServices class.
    Example: .AddDbContext<ProjectNameContext> changed to .AddDbContext<ToDoListContext>
  • In ProjectNameContext.cs model the DbSet type and name should be renamed to what the table in the database represents.
  • Make sure to rename ProjectName & ClassName in ProjectName.Tests to match those in the ProjectName directory tree.
  • Rename the ProjectName in the following files for use: ProjectName in all folder its included in, Homecontroller.cs, ClassName.cs, PageName.cshtml, Program.cs,ProjectNameContext.cs, and Startup.cs.
  • Once everything is renamed and can build navigate into the production folder ProjectName/ProjectName/ and run the following command to make the initial migrations directory:
    dotnet ef migrations add Initial

* When renaming project files for new project make sure to rename all fields with "ProjectName" as the directory/file name. This includes line 13 of "ProjectName.Tests.csproj" to the names of your directories.
  • Make sure to change the Identity services configuration to make passwords more secure as the current settings are in place to make development easier but are not good settings for secure passwords

Known Bugs

  • No known issues

Contact Me

Let me know if you run into any issues or have questions, ideas or concerns:
{PUT EMAIL HERE}

License

MIT

Copyright (c) date author name(s)

About

C# Asp with Identity and Entity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors