|
1 | | -# ASP\.NETBoilerplate Tutorial |
2 | | -* [How to Initialize and Run a Clean Template](how-to-initialize-and-run-a-clean-template) |
3 | | -* [How to Create an Entity]() |
4 | | -* [How to Update the Database]() |
5 | | -* [How to Create an Application Service]() |
| 1 | +# ASP\.NET Boilerplate Tutorials |
| 2 | +* [How to Initialize and Run a Clean Template](#how-to-initialize-and-run-a-clean-template) |
| 3 | +* [How to Create an Entity](#how-to-create-an-entity) |
| 4 | +* [How to Update the Database](#how-to-update-the-database) |
| 5 | +* [How to Create an Application Service](#how-create-an-application-service) |
6 | 6 |
|
7 | | -## How to Initialize and Run a Clean Template |
| 7 | +# How to Initialize and Run a Clean Template |
8 | 8 | 1. [Download ASP\.NET Boilerplate template](#1-download-template) |
9 | 9 | 2. [Fix EFCore Versions & Add DotNet Tooling](#2-fix-efcore-versions--add-dotnet-tooling) |
10 | 10 | 3. [Change Database Connection String](#3-change-database-connection-string) |
|
25 | 25 | \.NET Core can be thought of as a cross-platform version of the \.NET Framework supporting Windows, macOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios. It implements the \.NET Standard Library specification. |
26 | 26 |
|
27 | 27 | #### ASP\.NET Core |
28 | | -ASP\.NET Core is no longer based on System\.Web\.dll |
| 28 | +ASP\.NET Core is no longer based on __System.Web.dll__ |
29 | 29 | ASP\.NET Core apps can run on \.NET Core or on the full \.NET Framework |
30 | 30 |
|
31 | 31 | #### Entity Framework Core |
@@ -56,7 +56,7 @@ Note there is an extra reference added to enable using the Entity Framework Core |
56 | 56 | ``` |
57 | 57 |
|
58 | 58 | ## 3. Change Database Connection String |
59 | | -Edit _appsettings.json_ in __/aspnet-core/src/project.Web.Host__ to change the connection string to use __localdb__. |
| 59 | +Edit _appsettings.json_ in __.Web.Host__ to change the connection string to use __localdb__. |
60 | 60 | ```javascript |
61 | 61 | "ConnectionStrings": { |
62 | 62 | "Default": "Data Source=(localdb)\\MSSQLLocalDB; Initial Catalog=PeopleProject;" |
@@ -107,3 +107,22 @@ http://localhost:4200 |
107 | 107 | # Congratulations! We're halfway there! |
108 | 108 | > At this point we've downloaded, initialized and run the bare template. Well done on making it this far. |
109 | 109 | > Now we can start to create our own customizations on top of the ASP\.NET Boilerplate platform. |
| 110 | +
|
| 111 | +# How to Create an Entity |
| 112 | +TODO |
| 113 | +# How to Update the Database |
| 114 | +TODO |
| 115 | +# How to Create an Application Service |
| 116 | +* [Unit of Work](#unit-of-work) |
| 117 | +* [Hide from Controller](#hide-from-controller) |
| 118 | + |
| 119 | +### Unit of Work |
| 120 | +By default functions in an application service are transactional, meaning if there's an exception in the function then all repository functions are rolled back. It can be turned off by adding the ```UnitOfWork``` attribute to your function and setting ```IsDisabled``` to ```true```. |
| 121 | +```csharp |
| 122 | +[UnitOfWork(IsDisabled: true)] |
| 123 | +``` |
| 124 | +### Hide from Controller |
| 125 | +The __.Web.Core__ module is configured to generate WebAPI controllers for any application services found in __.Application__. To prevent a specific application service or function in a service from being generated, add the ```RemoteService``` attibute and set ```isEnabled``` to ```false```. |
| 126 | +```csharp |
| 127 | +[RemoteService(isEnabled: false)] |
| 128 | +``` |
0 commit comments