A .NET Core demo application which uses the Onion Architecture
See the contents of the LICENSE file for details
If you have found this project helpful, either as a library that you use or as a learning tool, please consider buying me a coffee:
Pull requests are welcome, but please take a moment to read the Code of Conduct before submitting them or commenting on any work in this repo.
OnionArch has a Code of Conduct which all contributors, maintainers and forkers must adhere to. When contributing, maintaining, forking or in any other way changing the code presented in this repository, all users must agree to this Code of Conduct.
See Code of Conduct.md for details.
To use the template locally, it will need to be installed. You can do this from either the NuGet package (see the next section) or by installing it from source. To install from source, please seen the NuGetReadMe.md file for instructions.
This project is now available as a NuGet package
appsettings.json
file contains a valid ConnectionStrings
section.You will need two connection strings:
This is the database which will contain all of the Book and Series information
This is the database which will contain all of the ASP.NET MVC Core auth information.
Example ConnectionStrings section:
"ConnectionStrings": {
"onionDataConnection": "DataSource=onionData.db",
"onionAuthConnection": "DataSource=onionAuth.db"
},
Onion.Web
directoryIssue the following commands to set up the databases:
dotnet restore
Check for migrations in the Onion.Repo.Identity
directory. If there isn't a directory labelled Migrations
, then run the following (from the Onion.Web
) directory to generate them:
dotnet ef migrations add CreateIdentitySchema -c AppIdentityDbContext -p ../Onion.Repo/Onion.Repo.csproj -s Onion.Web.csproj
Similarly, check for migrations in the Onion.Repo.Data
directory. If there isn't a directory labelled Migrations
, then run the following (from the Onion.Web
) directory to generate them:
dotnet ef migrations add InitialMigration -c DataContext -p ../Onion.Repo/Onion.Repo.csproj -s Onion.Web.csproj
Apply all migrations to the databases by running the following commands (from the Onion.Web
directory):
dotnet ef database update -c DataContext -p ../Onion.Repo/Onion.Repo.csproj -s Onion.Web.csproj
dotnet ef database update -c AppIdentityDbContext -p ../Onion.Repo/Onion.Repo.csproj -s Onion.Web.csproj
Issue the following commands from the Onion.Web
directory:
npm i
npm run build
Issue the following command from the Onion.Web
directory:
dotnet run