This is a common template for most .NET Core Projects that may come along
- ASP.NET Core Identity
- IdentityServer4
- Serilog
- EFCore
- Sendgrid
- CsvHelper
- Right click solution and chose
Set Startup Projects...
- Choose option
Multiple Startup Projects
- Select
TemplateApi
,TemplateIdentityServer
, andTemplateJsClient
- In Visual Studio
Start
the application(s)
Admin user is setup automatically, the username is admin
and password is ASDFasdf!
Getting a token looks like this:
POST /connect/token HTTP/1.1
Host: localhost:44319
Content-Type: application/x-www-form-urlencoded
Content-Length: 112
client_secret=secret&scope=openid%20api1&grant_type=password&username=admin&password=ASDFasdf!&client_id=postman
- open
Package Manager Console
- setup startup project to
TemplateBase
- set default project to
TemplateBase
- run
add-migration [Migration Name] -o "Common/Data/Migrations"
- double check to make sure the migration is correct
- open
Package Manager Console
- setup startup project to
TemplateBase
- set default project to
TemplateBase
- run
update-database
to update your local database
- Services don't reference other services (to avoid circular dependency)
- Managers can reference as many services as neeeded, and can reference other managers
- Repositories are generic but can be customized with extension methods
- Entity classes shouldn't contain any logic unless it's part of a computed column
- If entity class needs logic, write an extension method
- Dtos types: ViewModels, Form, Info, etc
- 2 types of Dto, Basic, Composite
- Basic typically dtos don't have constructor, have mapping with automapper
- Use inheritance with AutoMapper using .IncludeAllDerived() between mappings
- Composite Dtos get hydrated from other basic dtos.
- Service methods never return entities
- Entities and Dtos can coordinate properties with interface (See IProvider)