- Using OData to speed up rest API development
- Introducing the NuGet package: Microsoft.AspNet.WebApi.OData
- Add the following configuration in the Startup class (examples are global, or can be implemented based on a controller or action):
- Use Cors for cross-domain access:
- Introducing the NuGet package: Microsoft.AspNet.WebApi.Cors
- Add the following configuration in the Startup class (examples are global, or can be implemented based on a controller or action):
- Use OAuth 2 for identity authentication:
- Introducing the NuGet package: Microsoft.Owin.Security.OAuth
- Create Applicationoauthprovider Class (Generate Beaer Token after successful login):
-
- To enable OAuth authentication in the Startup class:
- Enable swagger to expose and debug the rest API:
- Introducing the NuGet package: Swashbuckle.core
- To add the Httpheaderfilter class:
-
- In the Startup class configuration, enable swagger:
- Log system logs using log4net:
- Introducing the NuGet package: log4net
- Configure in app. config:
-
- Start the log4net in the startup class;
-
- Add the following code where you want the log to be entered:
My C # cross-platform Journey (iv): Using AOP for system enhancements