The original example has been taken from Pluralsight Course. And this has been modified to introduce
- Onion Architecture
- Swagger API
- Serilog (for logging purpose)
- Microsoft.Extensions.Options
- .NetCore2.0 and -Entity Framework core instead of NHibernate and Hilo
- Build the project
- Open a command prompt
- Go to the Template.DAL folder
- Execute
dotnet ef database update
Set Template.Api as your startup project and run on kestrel.
Note: At the moment, an issue is raised for Edge Please use chrome or others to run the swagger
To create a migration script
dotnet ef migrations add Initial
To execute the script
dotnet ef database update
To remove the latest migration script
dotnet ef migrations remove
To drop the database
dotnet ef database drop
- here Inital is the name of migration script
The difference between TryAddSingleton and AddSingleton is that AddSingleton always appends the registration to the collection, while TryAddSingleton only does this when there exists no registration for the given service type.