├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ └── dotnet.yml
├── .gitignore
├── Ingos.Abp.Templates.csproj
├── LICENSE
├── README-zh.md
├── README.md
├── resource
└── images
│ ├── architecture.png
│ ├── creation.png
│ ├── install.png
│ ├── logo.png
│ └── running.png
├── scripts
├── build-docker-image.ps1
├── build-docker-image.sh
├── pack-nuget-package.ps1
└── pack-nuget-package.sh
├── templates
├── .dockerignore
├── .template.config
│ └── template.json
├── Dockerfile
├── IngosAbpTemplate.sln
├── deploy
│ └── deployment.yaml
└── src
│ ├── IngosAbpTemplate.API
│ ├── Controllers
│ │ └── BaseController.cs
│ ├── Infrastructure
│ │ └── RemoveVersionFromParameter.cs
│ ├── IngosAbpTemplate.API.csproj
│ ├── IngosAbpTemplateApiModule.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Startup.cs
│ ├── appsettings.json
│ └── wwwroot
│ │ └── api-doc
│ │ ├── IngosAbpTemplate.API.xml
│ │ ├── IngosAbpTemplate.Application.Contracts.xml
│ │ └── IngosAbpTemplate.Application.xml
│ ├── IngosAbpTemplate.Application.Contracts
│ ├── IngosAbpTemplate.Application.Contracts.csproj
│ ├── IngosAbpTemplateApplicationContractsModule.cs
│ ├── IngosAbpTemplateDtoExtensions.cs
│ └── Permissions
│ │ ├── IngosAbpTemplatePermissionDefinitionProvider.cs
│ │ └── IngosAbpTemplatePermissions.cs
│ ├── IngosAbpTemplate.Application
│ ├── BaseAppService.cs
│ ├── IngosAbpTemplate.Application.csproj
│ ├── IngosAbpTemplateApplicationAutoMapperProfile.cs
│ └── IngosAbpTemplateApplicationModule.cs
│ ├── IngosAbpTemplate.Domain.Shared
│ ├── IngosAbpTemplate.Domain.Shared.csproj
│ ├── IngosAbpTemplateDomainErrorCodes.cs
│ ├── IngosAbpTemplateDomainSharedModule.cs
│ ├── IngosAbpTemplateModuleExtensionConfigurator.cs
│ └── Localization
│ │ ├── IngosAbpTemplate
│ │ ├── en.json
│ │ ├── zh-Hans.json
│ │ └── zh-Hant.json
│ │ └── IngosAbpTemplateResource.cs
│ ├── IngosAbpTemplate.Domain
│ ├── IngosAbpTemplate.Domain.csproj
│ └── IngosAbpTemplateDomainModule.cs
│ └── IngosAbpTemplate.Infrastructure
│ ├── EntityConfigurations
│ ├── Consts.cs
│ ├── DbContextFactory.cs
│ ├── EntityConfigurationExtensions.cs
│ └── EntityExtraPropertyExtensionMappings.cs
│ ├── IngosAbpTemplate.Infrastructure.csproj
│ ├── IngosAbpTemplateDbContext.cs
│ └── IngosAbpTemplateInfrastructureModule.cs
└── version
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: build and publish
2 |
3 | on:
4 | push:
5 | branches: [main]
6 | pull_request:
7 | branches: [main]
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - uses: actions/checkout@v2
15 | - name: Setup dotnet core environment
16 | uses: actions/setup-dotnet@v1
17 | with:
18 | dotnet-version: 5.0.x
19 | - name: Restore dependencies
20 | run: dotnet restore
21 | - name: Build template
22 | run: dotnet build --no-restore
23 | - name: Pack
24 | run: dotnet pack --no-build -o .
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 |
34 | # Visual Studio 2015/2017 cache/options directory
35 | .vs/
36 | # Uncomment if you have tasks that create the project's static files in wwwroot
37 | #wwwroot/
38 |
39 | # Visual Studio 2017 auto generated files
40 | Generated\ Files/
41 |
42 | # MSTest test Results
43 | [Tt]est[Rr]esult*/
44 | [Bb]uild[Ll]og.*
45 |
46 | # NUnit
47 | *.VisualState.xml
48 | TestResult.xml
49 | nunit-*.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | # Benchmark Results
57 | BenchmarkDotNet.Artifacts/
58 |
59 | # .NET Core
60 | project.lock.json
61 | project.fragment.lock.json
62 | artifacts/
63 |
64 | # StyleCop
65 | StyleCopReport.xml
66 |
67 | # Files built by Visual Studio
68 | *_i.c
69 | *_p.c
70 | *_h.h
71 | *.ilk
72 | *.meta
73 | *.obj
74 | *.iobj
75 | *.pch
76 | *.pdb
77 | *.ipdb
78 | *.pgc
79 | *.pgd
80 | *.rsp
81 | *.sbr
82 | *.tlb
83 | *.tli
84 | *.tlh
85 | *.tmp
86 | *.tmp_proj
87 | *_wpftmp.csproj
88 | *.log
89 | *.vspscc
90 | *.vssscc
91 | .builds
92 | *.pidb
93 | *.svclog
94 | *.scc
95 |
96 | # Chutzpah Test files
97 | _Chutzpah*
98 |
99 | # Visual C++ cache files
100 | ipch/
101 | *.aps
102 | *.ncb
103 | *.opendb
104 | *.opensdf
105 | *.sdf
106 | *.cachefile
107 | *.VC.db
108 | *.VC.VC.opendb
109 |
110 | # Visual Studio profiler
111 | *.psess
112 | *.vsp
113 | *.vspx
114 | *.sap
115 |
116 | # Visual Studio Trace Files
117 | *.e2e
118 |
119 | # TFS 2012 Local Workspace
120 | $tf/
121 |
122 | # Guidance Automation Toolkit
123 | *.gpState
124 |
125 | # ReSharper is a .NET coding add-in
126 | _ReSharper*/
127 | *.[Rr]e[Ss]harper
128 | *.DotSettings.user
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # NuGet Symbol Packages
188 | *.snupkg
189 | # The packages folder can be ignored because of Package Restore
190 | **/[Pp]ackages/*
191 | # except build/, which is used as an MSBuild target.
192 | !**/[Pp]ackages/build/
193 | # Uncomment if necessary however generally it will be regenerated when needed
194 | #!**/[Pp]ackages/repositories.config
195 | # NuGet v3's project.json files produces more ignorable files
196 | *.nuget.props
197 | *.nuget.targets
198 |
199 | # Microsoft Azure Build Output
200 | csx/
201 | *.build.csdef
202 |
203 | # Microsoft Azure Emulator
204 | ecf/
205 | rcf/
206 |
207 | # Windows Store app package directories and files
208 | AppPackages/
209 | BundleArtifacts/
210 | Package.StoreAssociation.xml
211 | _pkginfo.txt
212 | *.appx
213 | *.appxbundle
214 | *.appxupload
215 |
216 | # Visual Studio cache files
217 | # files ending in .cache can be ignored
218 | *.[Cc]ache
219 | # but keep track of directories ending in .cache
220 | !?*.[Cc]ache/
221 |
222 | # Others
223 | ClientBin/
224 | ~$*
225 | *~
226 | *.dbmdl
227 | *.dbproj.schemaview
228 | *.jfm
229 | *.pfx
230 | *.publishsettings
231 | orleans.codegen.cs
232 |
233 | # Including strong name files can present a security risk
234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
235 | #*.snk
236 |
237 | # Since there are multiple workflows, uncomment next line to ignore bower_components
238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
239 | #bower_components/
240 |
241 | # RIA/Silverlight projects
242 | Generated_Code/
243 |
244 | # Backup & report files from converting an old project file
245 | # to a newer Visual Studio version. Backup files are not needed,
246 | # because we have git ;-)
247 | _UpgradeReport_Files/
248 | Backup*/
249 | UpgradeLog*.XML
250 | UpgradeLog*.htm
251 | ServiceFabricBackup/
252 | *.rptproj.bak
253 |
254 | # SQL Server files
255 | *.mdf
256 | *.ldf
257 | *.ndf
258 |
259 | # Business Intelligence projects
260 | *.rdl.data
261 | *.bim.layout
262 | *.bim_*.settings
263 | *.rptproj.rsuser
264 | *- [Bb]ackup.rdl
265 | *- [Bb]ackup ([0-9]).rdl
266 | *- [Bb]ackup ([0-9][0-9]).rdl
267 |
268 | # Microsoft Fakes
269 | FakesAssemblies/
270 |
271 | # GhostDoc plugin setting file
272 | *.GhostDoc.xml
273 |
274 | # Node.js Tools for Visual Studio
275 | .ntvs_analysis.dat
276 | node_modules/
277 |
278 | # Visual Studio 6 build log
279 | *.plg
280 |
281 | # Visual Studio 6 workspace options file
282 | *.opt
283 |
284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285 | *.vbw
286 |
287 | # Visual Studio LightSwitch build output
288 | **/*.HTMLClient/GeneratedArtifacts
289 | **/*.DesktopClient/GeneratedArtifacts
290 | **/*.DesktopClient/ModelManifest.xml
291 | **/*.Server/GeneratedArtifacts
292 | **/*.Server/ModelManifest.xml
293 | _Pvt_Extensions
294 |
295 | # Paket dependency manager
296 | .paket/paket.exe
297 | paket-files/
298 |
299 | # FAKE - F# Make
300 | .fake/
301 |
302 | # CodeRush personal settings
303 | .cr/personal
304 |
305 | # Python Tools for Visual Studio (PTVS)
306 | __pycache__/
307 | *.pyc
308 |
309 | # Cake - Uncomment if you are using it
310 | # tools/**
311 | # !tools/packages.config
312 |
313 | # Tabs Studio
314 | *.tss
315 |
316 | # Telerik's JustMock configuration file
317 | *.jmconfig
318 |
319 | # BizTalk build output
320 | *.btp.cs
321 | *.btm.cs
322 | *.odx.cs
323 | *.xsd.cs
324 |
325 | # OpenCover UI analysis results
326 | OpenCover/
327 |
328 | # Azure Stream Analytics local run output
329 | ASALocalRun/
330 |
331 | # MSBuild Binary and Structured Log
332 | *.binlog
333 |
334 | # NVidia Nsight GPU debugger configuration file
335 | *.nvuser
336 |
337 | # MFractors (Xamarin productivity tool) working folder
338 | .mfractor/
339 |
340 | # Local History for Visual Studio
341 | .localhistory/
342 |
343 | # BeatPulse healthcheck temp database
344 | healthchecksdb
345 |
346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
347 | MigrationBackup/
348 |
349 | # Ionide (cross platform F# VS Code tools) working folder
350 | .ionide/
351 | .idea
352 |
--------------------------------------------------------------------------------
/Ingos.Abp.Templates.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Template
5 | 1.0.8
6 | Ingos.Abp.Templates
7 | Ingos.Abp.Templates
8 | Danvic Wang
9 | Ingos Web API Template with ABP Framework
10 | dotnet-new;templates;abp;domain-driven-design;architecture;dapr
11 |
12 | net5.0
13 |
14 | true
15 | false
16 | content
17 | $(NoWarn);NU5128
18 | MIT
19 | Copyright (c) 2021 Danvic Wang
20 | logo.png
21 | Ingos.Abp.Templates
22 | Danvic Wang
23 | https://github.com/danvic712/ingos-abp-api-template
24 | https://github.com/danvic712/ingos-abp-api-template
25 | git
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | True
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Danvic Wang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README-zh.md:
--------------------------------------------------------------------------------
1 | # ingos-abp-api-template
2 | [English](./README.md) | 简体中文
3 |
4 | 这是一个集成了 dapr 的精简版 abp vnext web api 项目模板
5 |
6 |
7 |
8 | ## Architecture
9 |
10 | 
11 |
12 |
13 |
14 | ## Get Started
15 |
16 | ### 1、加载模板
17 |
18 | Similar to installing other dotnet tools, you can use `dotnet new` command to install this template on your computer.
19 |
20 | ```sh
21 | -- it will install this template in your computer
22 | dotnet new -i Ingos.Abp.Templates
23 | ```
24 |
25 | Also, if you want to install the specified version, you need to add the version no after the name of the template
26 |
27 | ```sh
28 | -- it will install the 1.0.0 version of this template
29 | dotnet new -i Ingos.Abp.Templates::1.0.0
30 | ```
31 |
32 | When you see the following picture, it means that the template has been installed successfully
33 |
34 | 
35 |
36 |
37 |
38 | ### 2、如何使用
39 |
40 | After you have installed this template, you can use dotnet cli to create a new project based on this template, just like the following shell.
41 |
42 | ```sh
43 | -- it will create a project which named Sample
44 | dotnet new ingos-abp-api -n Sample
45 | ```
46 |
47 | PS, please do not include special symbols in the project name
48 |
49 | If you want to learn more about this template, you can enter the following shell script to get help information.
50 |
51 | ```shell
52 | dotnet new ingos-abp-api --help
53 | ```
54 |
55 | If you want to see the use case of this template, you can view this repository([ingos-configuration](https://github.com/danvic712/ingos-configuration))
56 |
57 | Or you can using the latest Visual Studio to create the project, but please note that this cannot modify the default database option. The default database is MySQL.
58 |
59 | 
60 |
61 | When you create a new project, you need to change the connection string first, it located in the `appsetting.json` file
62 |
63 | ```json
64 | {
65 | "ConnectionStrings": {
66 | "Default": "Server=Server Address;Port=3306;Database=Change_To_Your_Database_Here;Uid=root;Pwd=Change_To_Your_Password_Here"
67 | }
68 | }
69 | ```
70 |
71 | Locate the `*.Infrastructure` path in the console, and then you can execute the ef migrations command to restore framework built-in tables, wait for the command execution complete
72 |
73 | ```shell
74 | -- create a new migration
75 | dotnet ef migrations add Initialize
76 |
77 | -- apply the changes
78 | dotnet ef database update
79 | ```
80 |
81 | Now you can run this project, wait for the browser to open automatically and then enjoy you development
82 |
83 | 
84 |
85 |
86 |
87 | ### 3、卸载模板
88 |
89 | ```shell
90 | -- it will uninstall this template from your computer
91 | dotnet new -u Ingos.Abp.Templates
92 | ```
93 |
94 |
95 |
96 | ## 参考引用
97 |
98 | If you want to find some related development documents, you can try from the link below
99 |
100 | 1. [Implementing domain driven design using abp template](https://docs.abp.io/en/abp/latest/Domain-Driven-Design)
101 | 2. [墨墨墨墨小宇's CnBlog Site(只包含中文版本)](https://www.cnblogs.com/danvic712/)
102 |
103 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ingos-abp-api-template
2 | English | [简体中文](./README-zh.md)
3 |
4 | a simplified version of abp vnext web api template with integrated dapr
5 |
6 |
7 |
8 | ## Architecture
9 |
10 | 
11 |
12 |
13 |
14 | ## Get Started
15 |
16 | ### 1、Install
17 |
18 | Similar to installing other dotnet tools, you can use `dotnet new` command to install this template on your computer.
19 |
20 | ```sh
21 | -- it will install this template in your computer
22 | dotnet new -i Ingos.Abp.Templates
23 | ```
24 |
25 | Also, if you want to install the specified version, you need to add the version no after the name of the template
26 |
27 | ```sh
28 | -- it will install the 1.0.0 version of this template
29 | dotnet new -i Ingos.Abp.Templates::1.0.0
30 | ```
31 |
32 | When you see the following picture, it means that the template has been installed successfully
33 |
34 | 
35 |
36 |
37 |
38 | ### 2、How to use
39 |
40 | After you have installed this template, you can use dotnet cli to create a new project based on this template, just like the following shell.
41 |
42 | ```sh
43 | -- it will create a project which named Sample
44 | dotnet new ingos-abp-api -n Sample
45 | ```
46 |
47 | PS, please do not include special symbols in the project name
48 |
49 | If you want to learn more about this template, you can enter the following shell script to get help information.
50 |
51 | ```shell
52 | dotnet new ingos-abp-api --help
53 | ```
54 |
55 | If you want to see the use case of this template, you can view this repository([ingos-configuration](https://github.com/danvic712/ingos-configuration))
56 |
57 | Or you can using the latest Visual Studio to create the project, but please note that this cannot modify the default database option. The default database is MySQL.
58 |
59 | 
60 |
61 | When you create a new project, you need to change the connection string first, it located in the `appsetting.json` file
62 |
63 | ```json
64 | {
65 | "ConnectionStrings": {
66 | "Default": "Server=Server Address;Port=3306;Database=Change_To_Your_Database_Here;Uid=root;Pwd=Change_To_Your_Password_Here"
67 | }
68 | }
69 | ```
70 |
71 | Locate the `*.Infrastructure` path in the console, and then you can execute the ef migrations command to restore framework built-in tables, wait for the command execution complete
72 |
73 | ```shell
74 | -- create a new migration
75 | dotnet ef migrations add Initialize
76 |
77 | -- apply the changes
78 | dotnet ef database update
79 | ```
80 |
81 | Now you can run this project, wait for the browser to open automatically and then enjoy you development
82 |
83 | 
84 |
85 |
86 |
87 | ### 3、Uninstall
88 |
89 | ```shell
90 | -- it will uninstall this template from your computer
91 | dotnet new -u Ingos.Abp.Templates
92 | ```
93 |
94 |
95 |
96 | ## Reference
97 |
98 | If you want to find some related development documents, you can try from the link below
99 |
100 | 1. [Implementing domain driven design using abp template](https://docs.abp.io/en/abp/latest/Domain-Driven-Design)
101 | 2. [墨墨墨墨小宇's CnBlog Site(only Chinese)](https://www.cnblogs.com/danvic712/)
102 |
103 |
--------------------------------------------------------------------------------
/resource/images/architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danvic712/ingos-abp-api-template/5448a27c5ce1e06758cdd2a3e63014c5158fcffe/resource/images/architecture.png
--------------------------------------------------------------------------------
/resource/images/creation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danvic712/ingos-abp-api-template/5448a27c5ce1e06758cdd2a3e63014c5158fcffe/resource/images/creation.png
--------------------------------------------------------------------------------
/resource/images/install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danvic712/ingos-abp-api-template/5448a27c5ce1e06758cdd2a3e63014c5158fcffe/resource/images/install.png
--------------------------------------------------------------------------------
/resource/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danvic712/ingos-abp-api-template/5448a27c5ce1e06758cdd2a3e63014c5158fcffe/resource/images/logo.png
--------------------------------------------------------------------------------
/resource/images/running.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danvic712/ingos-abp-api-template/5448a27c5ce1e06758cdd2a3e63014c5158fcffe/resource/images/running.png
--------------------------------------------------------------------------------
/scripts/build-docker-image.ps1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danvic712/ingos-abp-api-template/5448a27c5ce1e06758cdd2a3e63014c5158fcffe/scripts/build-docker-image.ps1
--------------------------------------------------------------------------------
/scripts/build-docker-image.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | COMMIT_ID=$(git rev-parse --short HEAD)
3 |
4 | #REGISTRY=https://docker.pkg.github.com/danvic712/ingos-abp-api-template
5 | IMAGE=ingos/ingos-template
6 |
7 | VERSION=$(cat version)
8 | TAG=$(echo "$VERSION" | awk -F. -v OFS=. '{$NF++;print}')
9 | echo "$TAG" > version
10 |
11 | if [ "$COMMIT_ID" == "" ]; then
12 | IMAGE_TAG=$IMAGE:$TAG
13 | else
14 | IMAGE_TAG=$IMAGE:$TAG-$COMMIT_ID
15 | fi
16 |
17 | docker build -t "$IMAGE_TAG" --build-arg commit-id="$COMMIT_ID" .
18 | # docker push "$IMAGE_TAG"
19 |
20 |
--------------------------------------------------------------------------------
/scripts/pack-nuget-package.ps1:
--------------------------------------------------------------------------------
1 | # packing the nuget package
2 | Write-Output "1. packing the nuget package..."
3 | dotnet pack ../Ingos.Abp.Templates.csproj --output ../
4 | Write-Output " packing end."
5 |
6 | # delete bin and obj folders
7 | Write-Output "2. clean up the folders generated during the packaging process..."
8 | Remove-Item ../bin, ../obj -Recurse
9 | Write-Output " clean up end."
10 |
11 |
--------------------------------------------------------------------------------
/scripts/pack-nuget-package.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
--------------------------------------------------------------------------------
/templates/.dockerignore:
--------------------------------------------------------------------------------
1 | **/.dockerignore
2 | **/.env
3 | **/.git
4 | **/.gitignore
5 | **/.project
6 | **/.settings
7 | **/.toolstarget
8 | **/.vs
9 | **/.vscode
10 | **/.idea
11 | **/*.*proj.user
12 | **/*.dbmdl
13 | **/*.jfm
14 | **/azds.yaml
15 | **/bin
16 | **/charts
17 | **/docker-compose*
18 | **/Dockerfile*
19 | **/node_modules
20 | **/npm-debug.log
21 | **/obj
22 | **/secrets.dev.yaml
23 | **/values.dev.yaml
24 | LICENSE
25 | README.md
--------------------------------------------------------------------------------
/templates/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/template",
3 | "author": "Danvic Wang",
4 | "classifications": [ "Web/WebAPI" ],
5 | "name": "Ingos Web API with ABP Framework",
6 | "identity": "Ingos.Abp.Templates",
7 | "shortName": "ingos-abp-api",
8 | "tags": {
9 | "language": "C#",
10 | "type": "project"
11 | },
12 | "symbols":{
13 | "dbType": {
14 | "type": "parameter",
15 | "datatype": "choice",
16 | "choices": [
17 | {
18 | "choice": "MySQL",
19 | "description": "MySQL"
20 | },
21 | {
22 | "choice": "MsSQL",
23 | "description": "Microsoft SQL Server"
24 | },
25 | {
26 | "choice": "PgSQL",
27 | "description": "PostgreSQL"
28 | }
29 | ],
30 | "defaultValue": "MySQL",
31 | "description": "The type of database you want to use"
32 | },
33 | "MySQL": {
34 | "type": "computed",
35 | "value": "(dbType == \"MySQL\")"
36 | },
37 | "MsSQL": {
38 | "type": "computed",
39 | "value": "(dbType == \"MsSQL\")"
40 | },
41 | "PgSQL": {
42 | "type": "computed",
43 | "value": "(dbType == \"PgSQL\")"
44 | }
45 | },
46 | "sourceName": "IngosAbpTemplate",
47 | "preferNameDirectory": true
48 | }
--------------------------------------------------------------------------------
/templates/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
2 | WORKDIR /app
3 | EXPOSE 80
4 | EXPOSE 443
5 |
6 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
7 | COPY ./ /app
8 | WORKDIR /app/src/IngosAbpTemplate.API
9 | RUN dotnet restore
10 | RUN dotnet publish -c Release -o /app/publish --no-restore
11 |
12 | FROM base AS final
13 | WORKDIR /app
14 | COPY --from=build /app/publish .
15 | RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
16 | ENTRYPOINT ["dotnet", "IngosAbpTemplate.API.dll"]
--------------------------------------------------------------------------------
/templates/IngosAbpTemplate.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31025.194
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D9A8DC95-89BA-4BA7-BA9A-DB1AE0A4263C}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IngosAbpTemplate.Domain", "src\IngosAbpTemplate.Domain\IngosAbpTemplate.Domain.csproj", "{4AB79EEB-5626-4363-BE04-6C9560E0996E}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IngosAbpTemplate.Application", "src\IngosAbpTemplate.Application\IngosAbpTemplate.Application.csproj", "{9EA811F1-3BE3-4D4C-A22F-B0C677A2F6C8}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IngosAbpTemplate.Application.Contracts", "src\IngosAbpTemplate.Application.Contracts\IngosAbpTemplate.Application.Contracts.csproj", "{067F31EC-3153-4DBC-A173-AC892939E885}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IngosAbpTemplate.API", "src\IngosAbpTemplate.API\IngosAbpTemplate.API.csproj", "{D2683C86-4165-4A9F-95E7-06149842CC1F}"
15 | EndProject
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IngosAbpTemplate.Domain.Shared", "src\IngosAbpTemplate.Domain.Shared\IngosAbpTemplate.Domain.Shared.csproj", "{198458A9-EC6A-459D-9026-41478CC95F74}"
17 | EndProject
18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IngosAbpTemplate.Infrastructure", "src\IngosAbpTemplate.Infrastructure\IngosAbpTemplate.Infrastructure.csproj", "{4C9190A3-F6B0-4829-BEA0-F089AD2F8F5C}"
19 | EndProject
20 | Global
21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
22 | Debug|Any CPU = Debug|Any CPU
23 | Release|Any CPU = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
26 | {4AB79EEB-5626-4363-BE04-6C9560E0996E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {4AB79EEB-5626-4363-BE04-6C9560E0996E}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {4AB79EEB-5626-4363-BE04-6C9560E0996E}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {4AB79EEB-5626-4363-BE04-6C9560E0996E}.Release|Any CPU.Build.0 = Release|Any CPU
30 | {9EA811F1-3BE3-4D4C-A22F-B0C677A2F6C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {9EA811F1-3BE3-4D4C-A22F-B0C677A2F6C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {9EA811F1-3BE3-4D4C-A22F-B0C677A2F6C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {9EA811F1-3BE3-4D4C-A22F-B0C677A2F6C8}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {067F31EC-3153-4DBC-A173-AC892939E885}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {067F31EC-3153-4DBC-A173-AC892939E885}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {067F31EC-3153-4DBC-A173-AC892939E885}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {067F31EC-3153-4DBC-A173-AC892939E885}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {D2683C86-4165-4A9F-95E7-06149842CC1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {D2683C86-4165-4A9F-95E7-06149842CC1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {D2683C86-4165-4A9F-95E7-06149842CC1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {D2683C86-4165-4A9F-95E7-06149842CC1F}.Release|Any CPU.Build.0 = Release|Any CPU
42 | {198458A9-EC6A-459D-9026-41478CC95F74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 | {198458A9-EC6A-459D-9026-41478CC95F74}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 | {198458A9-EC6A-459D-9026-41478CC95F74}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {198458A9-EC6A-459D-9026-41478CC95F74}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {4C9190A3-F6B0-4829-BEA0-F089AD2F8F5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 | {4C9190A3-F6B0-4829-BEA0-F089AD2F8F5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 | {4C9190A3-F6B0-4829-BEA0-F089AD2F8F5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
49 | {4C9190A3-F6B0-4829-BEA0-F089AD2F8F5C}.Release|Any CPU.Build.0 = Release|Any CPU
50 | EndGlobalSection
51 | GlobalSection(SolutionProperties) = preSolution
52 | HideSolutionNode = FALSE
53 | EndGlobalSection
54 | GlobalSection(NestedProjects) = preSolution
55 | {4AB79EEB-5626-4363-BE04-6C9560E0996E} = {D9A8DC95-89BA-4BA7-BA9A-DB1AE0A4263C}
56 | {9EA811F1-3BE3-4D4C-A22F-B0C677A2F6C8} = {D9A8DC95-89BA-4BA7-BA9A-DB1AE0A4263C}
57 | {067F31EC-3153-4DBC-A173-AC892939E885} = {D9A8DC95-89BA-4BA7-BA9A-DB1AE0A4263C}
58 | {D2683C86-4165-4A9F-95E7-06149842CC1F} = {D9A8DC95-89BA-4BA7-BA9A-DB1AE0A4263C}
59 | {198458A9-EC6A-459D-9026-41478CC95F74} = {D9A8DC95-89BA-4BA7-BA9A-DB1AE0A4263C}
60 | {4C9190A3-F6B0-4829-BEA0-F089AD2F8F5C} = {D9A8DC95-89BA-4BA7-BA9A-DB1AE0A4263C}
61 | EndGlobalSection
62 | GlobalSection(ExtensibilityGlobals) = postSolution
63 | SolutionGuid = {A3646993-1282-4046-91E7-749E6E9DFC95}
64 | EndGlobalSection
65 | EndGlobal
66 |
--------------------------------------------------------------------------------
/templates/deploy/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: ingos-api-temlpate
5 | namespace: ingos
6 | labels:
7 | app: ingos-api-template
8 | spec:
9 | replicas: 1
10 | selector:
11 | matchLabels:
12 | app: ingos-api-template
13 | minReadySeconds: 5
14 | strategy:
15 | type: RollingUpdate
16 | rollingUpdate:
17 | maxUnavailable: 1
18 | maxSurge: 1
19 | template:
20 | metadata:
21 | labels:
22 | app: ingos-api-template
23 | version: v1
24 | annotations:
25 | dapr.io/enabled: "true"
26 | dapr.io/app-id: "ingos-api-template"
27 | spec:
28 | containers:
29 | - name: ingos-api-template
30 | image: ingos/ingos-api-template:latest # default pull the latest image version
31 | imagePullPolicy: Never
32 | readinessProbe:
33 | httpGet:
34 | path: v1.0/healthz
35 | port: 3500
36 | initialDelaySeconds: 5
37 | periodSeconds: 10
38 | timeoutSeconds: 5
39 | failureThreshold: 3
40 | ports:
41 | - containerPort: 80
42 | - containerPort: 443
43 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/Controllers/BaseController.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Danvic.Wang All rights reserved.
4 | //
5 | // Author: Danvic.Wang
6 | // Created DateTime: 2021/3/7 18:59:23
7 | // Modified by:
8 | // Description: Inherit your controllers from this class
9 | //-----------------------------------------------------------------------
10 |
11 | using IngosAbpTemplate.Domain.Shared.Localization;
12 | using Microsoft.AspNetCore.Http;
13 | using Microsoft.AspNetCore.Mvc;
14 | using Volo.Abp.AspNetCore.Mvc;
15 | using Volo.Abp.Http;
16 |
17 | namespace IngosAbpTemplate.API.Controllers
18 | {
19 | ///
20 | /// Base controller
21 | ///
22 | [Produces("application/json")]
23 | [Consumes("application/json")]
24 | [ProducesResponseType(StatusCodes.Status403Forbidden, Type = typeof(RemoteServiceErrorResponse))]
25 | public abstract class BaseController : AbpController
26 | {
27 | ///
28 | /// The base controller
29 | ///
30 | protected BaseController()
31 | {
32 | LocalizationResource = typeof(IngosAbpTemplateResource);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/Infrastructure/RemoveVersionFromParameter.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Danvic.Wang All rights reserved.
4 | //
5 | // Author: Danvic.Wang
6 | // Created DateTime: 2021-04-05 16:02
7 | // Modified by:
8 | // Description: Remove api version param from swagger doc
9 | // -----------------------------------------------------------------------
10 |
11 | using System.Linq;
12 | using Microsoft.OpenApi.Models;
13 | using Swashbuckle.AspNetCore.SwaggerGen;
14 |
15 | namespace IngosAbpTemplate.API.Infrastructure
16 | {
17 | ///
18 | /// Remove api version param from swagger doc
19 | ///
20 | public class RemoveVersionFromParameter : IOperationFilter
21 | {
22 | ///
23 | /// Apply the filter rule
24 | ///
25 | public void Apply(OpenApiOperation operation, OperationFilterContext context)
26 | {
27 | var versionParameter = operation.Parameters.FirstOrDefault(p => p.Name == "version");
28 | operation.Parameters.Remove(versionParameter);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/IngosAbpTemplate.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | true
6 | IngosAbpTemplate-4681b4fd-151f-4221-84a4-929d86723e4c
7 | Linux
8 | ..\..
9 |
10 |
11 |
12 | ./wwwroot/api-doc/IngosAbpTemplate.API.xml
13 |
14 |
15 |
16 |
17 | ./wwwroot/api-doc/IngosAbpTemplate.API.xml
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | all
31 | runtime; build; native; contentfiles; analyzers; buildtransitive
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | true
56 | PreserveNewest
57 | Always
58 |
59 |
60 | true
61 | PreserveNewest
62 | Always
63 |
64 |
65 | true
66 | PreserveNewest
67 | Always
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/IngosAbpTemplateApiModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using IngosAbpTemplate.API.Infrastructure;
6 | using IngosAbpTemplate.Application;
7 | using IngosAbpTemplate.Application.Contracts;
8 | using IngosAbpTemplate.Domain;
9 | using IngosAbpTemplate.Domain.Shared;
10 | using IngosAbpTemplate.Domain.Shared.Localization;
11 | using IngosAbpTemplate.Infrastructure;
12 | using Localization.Resources.AbpUi;
13 | using Microsoft.AspNetCore.Builder;
14 | using Microsoft.AspNetCore.Cors;
15 | using Microsoft.AspNetCore.DataProtection;
16 | using Microsoft.AspNetCore.Mvc;
17 | using Microsoft.AspNetCore.Mvc.ApiExplorer;
18 | using Microsoft.AspNetCore.Mvc.Versioning;
19 | using Microsoft.Extensions.Configuration;
20 | using Microsoft.Extensions.DependencyInjection;
21 | using Microsoft.Extensions.Hosting;
22 | using Microsoft.OpenApi.Models;
23 | using StackExchange.Redis;
24 | using Volo.Abp;
25 | using Volo.Abp.AspNetCore.Mvc;
26 | using Volo.Abp.AspNetCore.Mvc.AntiForgery;
27 | using Volo.Abp.AspNetCore.Serilog;
28 | using Volo.Abp.Auditing;
29 | using Volo.Abp.Autofac;
30 | using Volo.Abp.Caching;
31 | using Volo.Abp.Caching.StackExchangeRedis;
32 | using Volo.Abp.Localization;
33 | using Volo.Abp.Modularity;
34 | using Volo.Abp.PermissionManagement.HttpApi;
35 | using Volo.Abp.Swashbuckle;
36 | using Volo.Abp.VirtualFileSystem;
37 |
38 | namespace IngosAbpTemplate.API
39 | {
40 | ///
41 | /// Api module definition file
42 | ///
43 | [DependsOn(typeof(AbpAutofacModule),
44 | typeof(AbpCachingStackExchangeRedisModule),
45 | typeof(IngosAbpTemplateApplicationModule),
46 | typeof(IngosAbpTemplateInfrastructureModule),
47 | typeof(AbpPermissionManagementHttpApiModule),
48 | typeof(AbpAspNetCoreSerilogModule),
49 | typeof(AbpSwashbuckleModule)
50 | )]
51 | public class IngosAbpTemplateApiModule : AbpModule
52 | {
53 | private const string CorsPolicyName = "IngosAbpTemplate";
54 |
55 | #region Services
56 |
57 | ///
58 | /// Pre configure before inject services into service collection
59 | ///
60 | public override void PreConfigureServices(ServiceConfigurationContext context)
61 | {
62 | PreConfigure(options =>
63 | {
64 | // Set dynamic api router with api version info
65 | options.ConventionalControllers.Create(typeof(IngosAbpTemplateApplicationModule).Assembly,
66 | opts => { opts.RootPath = "v{version:apiVersion}"; });
67 |
68 | // Specify version info for framework built-in api
69 | options.ConventionalControllers.Create(typeof(AbpPermissionManagementHttpApiModule).Assembly,
70 | opts => { opts.ApiVersions.Add(new ApiVersion(1, 0)); });
71 | });
72 | }
73 |
74 | ///
75 | /// Configure application services
76 | ///
77 | public override void ConfigureServices(ServiceConfigurationContext context)
78 | {
79 | var configuration = context.Services.GetConfiguration();
80 | var hostingEnvironment = context.Services.GetHostingEnvironment();
81 |
82 | context.Services.AddHttpClient();
83 |
84 | context.Services.AddDaprClient();
85 |
86 | ConfigureHealthChecks(context);
87 | ConfigureAntiForgeryTokens();
88 | ConfigureAuditing(configuration);
89 | ConfigureConventionalControllers(context);
90 | ConfigureLocalization();
91 | ConfigureVirtualFileSystem(context);
92 | ConfigureCache(context, configuration, hostingEnvironment);
93 | ConfigureCors(context, configuration);
94 | ConfigureSwagger(context);
95 | }
96 |
97 | ///
98 | ///
99 | ///
100 | public override void OnApplicationInitialization(ApplicationInitializationContext context)
101 | {
102 | var app = context.GetApplicationBuilder();
103 | var env = context.GetEnvironment();
104 |
105 | if (env.IsDevelopment()) app.UseDeveloperExceptionPage();
106 |
107 | app.UseAbpRequestLocalization();
108 |
109 | app.UseCorrelationId();
110 | app.UseStaticFiles();
111 | app.UseRouting();
112 | app.UseCors(CorsPolicyName);
113 | app.UseAuthentication();
114 |
115 | app.UseAuthorization();
116 |
117 | app.UseHealthChecks("/health");
118 |
119 | app.UseSwagger();
120 | app.UseSwaggerUI(options =>
121 | {
122 | options.DocumentTitle = "IngosAbpTemplate API";
123 |
124 | // Display latest api version by default
125 | //
126 | var provider = context.ServiceProvider.GetRequiredService();
127 | var apiVersionList = provider.ApiVersionDescriptions
128 | .Select(i => $"v{i.ApiVersion.MajorVersion}")
129 | .Distinct().Reverse();
130 | foreach (var apiVersion in apiVersionList)
131 | options.SwaggerEndpoint($"/swagger/{apiVersion}/swagger.json",
132 | $"IngosAbpTemplate API {apiVersion?.ToUpperInvariant()}");
133 | });
134 |
135 | app.UseAuditing();
136 | app.UseAbpSerilogEnrichers();
137 | app.UseUnitOfWork();
138 | app.UseConfiguredEndpoints();
139 | }
140 |
141 | #endregion Services
142 |
143 | #region Methods
144 |
145 | private static void ConfigureHealthChecks(ServiceConfigurationContext context)
146 | {
147 | context.Services.AddHealthChecks()
148 | .AddDbContextCheck();
149 | }
150 |
151 | private void ConfigureAntiForgeryTokens()
152 | {
153 | Configure(options =>
154 | {
155 | options.TokenCookie.Expiration = TimeSpan.FromDays(365);
156 | options.AutoValidateIgnoredHttpMethods.Add("POST");
157 | });
158 | }
159 |
160 | private void ConfigureAuditing(IConfiguration configuration)
161 | {
162 | var applicationName = configuration["App:ApplicationName"];
163 |
164 | Configure(options =>
165 | {
166 | options.ApplicationName = applicationName; // Set the application name
167 | options.EntityHistorySelectors.AddAllEntities(); // Default saving all changes of entities
168 | });
169 | }
170 |
171 | private void ConfigureVirtualFileSystem(ServiceConfigurationContext context)
172 | {
173 | var hostingEnvironment = context.Services.GetHostingEnvironment();
174 |
175 | if (hostingEnvironment.IsDevelopment())
176 | Configure(options =>
177 | {
178 | options.FileSets.ReplaceEmbeddedByPhysical(
179 | Path.Combine(hostingEnvironment.ContentRootPath,
180 | $@"..{Path.DirectorySeparatorChar}/IngosAbpTemplate.Domain.Shared"));
181 | options.FileSets.ReplaceEmbeddedByPhysical(
182 | Path.Combine(hostingEnvironment.ContentRootPath,
183 | $@"..{Path.DirectorySeparatorChar}/IngosAbpTemplate.Domain"));
184 | options.FileSets.ReplaceEmbeddedByPhysical(
185 | Path.Combine(hostingEnvironment.ContentRootPath,
186 | $@"..{Path.DirectorySeparatorChar}/IngosAbpTemplate.Application.Contracts"));
187 | options.FileSets.ReplaceEmbeddedByPhysical(
188 | Path.Combine(hostingEnvironment.ContentRootPath,
189 | $@"..{Path.DirectorySeparatorChar}/IngosAbpTemplate.Application"));
190 | });
191 | }
192 |
193 | private void ConfigureConventionalControllers(ServiceConfigurationContext context)
194 | {
195 | Configure(options => { context.Services.ExecutePreConfiguredActions(options); });
196 |
197 | // Use lowercase routing and lowercase query string
198 | context.Services.AddRouting(options =>
199 | {
200 | options.LowercaseUrls = true;
201 | options.LowercaseQueryStrings = true;
202 | });
203 |
204 | context.Services.AddAbpApiVersioning(options =>
205 | {
206 | options.ReportApiVersions = true;
207 |
208 | options.AssumeDefaultVersionWhenUnspecified = true;
209 |
210 | options.DefaultApiVersion = new ApiVersion(1, 0);
211 |
212 | options.ApiVersionReader = new UrlSegmentApiVersionReader();
213 |
214 | var mvcOptions = context.Services.ExecutePreConfiguredActions();
215 | options.ConfigureAbp(mvcOptions);
216 | });
217 |
218 | context.Services.AddVersionedApiExplorer(option =>
219 | {
220 | option.GroupNameFormat = "'v'VVV";
221 |
222 | option.AssumeDefaultVersionWhenUnspecified = true;
223 | });
224 | }
225 |
226 | private static void ConfigureSwagger(ServiceConfigurationContext context)
227 | {
228 | context.Services.AddSwaggerGen(
229 | options =>
230 | {
231 | // Get application api version info
232 | var provider = context.Services.BuildServiceProvider()
233 | .GetRequiredService();
234 |
235 | // Generate swagger by api major version
236 | foreach (var description in provider.ApiVersionDescriptions)
237 | options.SwaggerDoc(description.GroupName, new OpenApiInfo
238 | {
239 | Contact = new OpenApiContact
240 | {
241 | Name = "Danvic Wang",
242 | Email = "danvic.wang@outlook.com",
243 | Url = new Uri("https://yuiter.com")
244 | },
245 | Description = "IngosAbpTemplate API",
246 | Title = "IngosAbpTemplate API",
247 | Version = $"v{description.ApiVersion.MajorVersion}"
248 | });
249 |
250 | options.DocInclusionPredicate((docName, description) =>
251 | {
252 | // Get api major version
253 | var apiVersion = $"v{description.GetApiVersion().MajorVersion}";
254 |
255 | if (!docName.Equals(apiVersion))
256 | return false;
257 |
258 | // Replace router parameter
259 | var values = description.RelativePath
260 | .Split('/')
261 | .Select(v => v.Replace("v{version}", apiVersion));
262 |
263 | description.RelativePath = string.Join("/", values);
264 |
265 | return true;
266 | });
267 |
268 | // Let params use the camel naming method
269 | options.DescribeAllParametersInCamelCase();
270 |
271 | // Remove version parameter info input in swagger page
272 | options.OperationFilter();
273 |
274 | // Inject api and dto comments
275 | //
276 | var paths = new List
277 | {
278 | @"wwwroot/api-doc/IngosAbpTemplate.API.xml",
279 | @"wwwroot/api-doc/IngosAbpTemplate.Application.xml",
280 | @"wwwroot/api-doc/IngosAbpTemplate.Application.Contracts.xml"
281 | };
282 | GetApiDocPaths(paths, Path.GetDirectoryName(AppContext.BaseDirectory))
283 | .ForEach(x => options.IncludeXmlComments(x, true));
284 | });
285 | }
286 |
287 | private void ConfigureLocalization()
288 | {
289 | Configure(options =>
290 | {
291 | options.Resources
292 | .Get()
293 | .AddBaseTypes(
294 | typeof(AbpUiResource)
295 | );
296 |
297 | options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
298 | options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文"));
299 | options.Languages.Add(new LanguageInfo("en", "en", "English"));
300 | });
301 | }
302 |
303 | private void ConfigureCache(ServiceConfigurationContext context, IConfiguration configuration,
304 | IHostEnvironment hostingEnvironment)
305 | {
306 | if (hostingEnvironment.IsDevelopment())
307 | return;
308 |
309 | // Get redis connection
310 | var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
311 |
312 | var prefix = configuration["Redis:KeyPrefix"];
313 |
314 | // Configure cache options
315 | Configure(options => { options.KeyPrefix = $"{prefix}:"; });
316 |
317 | // Add data protection
318 | //
319 | context.Services
320 | .AddDataProtection()
321 | .PersistKeysToStackExchangeRedis(redis, $"{prefix}:protection-keys");
322 | }
323 |
324 | private static void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
325 | {
326 | context.Services.AddCors(options =>
327 | {
328 | options.AddPolicy(CorsPolicyName, builder =>
329 | {
330 | builder
331 | .WithOrigins(
332 | configuration["App:CorsOrigins"]
333 | .Split(",", StringSplitOptions.RemoveEmptyEntries)
334 | .Select(o => o.RemovePostFix("/"))
335 | .ToArray()
336 | )
337 | .WithAbpExposedHeaders()
338 | .SetIsOriginAllowedToAllowWildcardSubdomains()
339 | .AllowAnyHeader()
340 | .AllowAnyMethod()
341 | .AllowCredentials();
342 | });
343 | });
344 | }
345 |
346 | ///
347 | /// Get the api description doc path
348 | ///
349 | /// The xml file path
350 | /// The site's base running files path
351 | ///
352 | private static List GetApiDocPaths(IEnumerable paths, string basePath)
353 | {
354 | var files = from path in paths
355 | let xml = Path.Combine(basePath, path)
356 | select xml;
357 |
358 | return files.ToList();
359 | }
360 |
361 | #endregion Methods
362 | }
363 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.Hosting;
4 | using Serilog;
5 | using Serilog.Events;
6 |
7 | namespace IngosAbpTemplate.API
8 | {
9 | ///
10 | ///
11 | public class Program
12 | {
13 | ///
14 | ///
15 | ///
16 | ///
17 | public static int Main(string[] args)
18 | {
19 | Log.Logger = new LoggerConfiguration()
20 | #if DEBUG
21 | .MinimumLevel.Debug()
22 | #else
23 | .MinimumLevel.Information()
24 | #endif
25 | .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
26 | .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
27 | .Enrich.FromLogContext()
28 | .WriteTo.Async(c => c.Console())
29 | #if DEBUG
30 | .WriteTo.Async(c => c.File("Logs/logs.txt"))
31 | #endif
32 | .CreateLogger();
33 |
34 | try
35 | {
36 | Log.Information("Starting IngosAbpTemplate.API");
37 | CreateHostBuilder(args).Build().Run();
38 | return 0;
39 | }
40 | catch (Exception ex)
41 | {
42 | Log.Fatal(ex, "Host terminated unexpectedly!");
43 | return 1;
44 | }
45 | finally
46 | {
47 | Log.CloseAndFlush();
48 | }
49 | }
50 |
51 | private static IHostBuilder CreateHostBuilder(string[] args)
52 | {
53 | return Host.CreateDefaultBuilder(args)
54 | .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); })
55 | .UseAutofac()
56 | .UseSerilog();
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5000",
7 | "sslPort": 0
8 | }
9 | },
10 | "$schema": "http://json.schemastore.org/launchsettings.json",
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "swagger",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "IngosAbpTemplate.API": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "swagger",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | },
27 | "applicationUrl": "http://localhost:5000"
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Builder;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.DependencyInjection;
4 |
5 | namespace IngosAbpTemplate.API
6 | {
7 | ///
8 | /// Application start up configuration
9 | ///
10 | public class Startup
11 | {
12 | ///
13 | ///
14 | public void ConfigureServices(IServiceCollection services)
15 | {
16 | services.AddApplication();
17 | }
18 |
19 | ///
20 | ///
21 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
22 | {
23 | app.InitializeApplication();
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "App": {
3 | "ApplicationName": "IngosAbpTemplate",
4 | "CorsOrigins": "https://*.IngosAbpTemplate.com,http://localhost:4200"
5 | },
6 | "ConnectionStrings": {
7 | "Default": "Server=Server Address;Port=3306;Database=Change_To_Your_Database_Here;Uid=root;Pwd=Change_To_Your_Password_Here"
8 | },
9 | "Redis": {
10 | "Configuration": "127.0.0.1",
11 | "KeyPrefix": "IngosAbpTemplate"
12 | },
13 | "Settings": {
14 | "Abp.Mailing.Smtp.Host": "127.0.0.1",
15 | "Abp.Mailing.Smtp.Port": "25",
16 | "Abp.Mailing.Smtp.UserName": "",
17 | "Abp.Mailing.Smtp.Password": "",
18 | "Abp.Mailing.Smtp.Domain": "",
19 | "Abp.Mailing.Smtp.EnableSsl": "false",
20 | "Abp.Mailing.Smtp.UseDefaultCredentials": "true",
21 | "Abp.Mailing.DefaultFromAddress": "noreply@ingos-abp-template.com",
22 | "Abp.Mailing.DefaultFromDisplayName": "IngosAbpTemplate"
23 | }
24 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/wwwroot/api-doc/IngosAbpTemplate.API.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | IngosAbpTemplate.API
5 |
6 |
7 |
8 |
9 | Base controller
10 |
11 |
12 |
13 |
14 | The base controller
15 |
16 |
17 |
18 |
19 | Remove api version param from swagger doc
20 |
21 |
22 |
23 |
24 | Apply the filter rule
25 |
26 |
27 |
28 |
29 | Api module definition file
30 |
31 |
32 |
33 |
34 | Pre configure before inject services into service collection
35 |
36 |
37 |
38 |
39 | Configure application services
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Get the api description doc path
50 |
51 | The xml file path
52 | The site's base running files path
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | Application start up configuration
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/wwwroot/api-doc/IngosAbpTemplate.Application.Contracts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | IngosAbpTemplate.Application.Contracts
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.API/wwwroot/api-doc/IngosAbpTemplate.Application.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | IngosAbpTemplate.Application
5 |
6 |
7 |
8 |
9 | Inherit your application services from this class.
10 |
11 |
12 |
13 |
14 | Base application service
15 |
16 |
17 |
18 |
19 | AutoMapper object mapper profile
20 |
21 |
22 |
23 |
24 | Application Module
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application.Contracts/IngosAbpTemplate.Application.Contracts.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | IngosAbpTemplate.Application.Contracts
6 |
7 |
8 |
9 | ../IngosAbpTemplate.API/wwwroot/api-doc/IngosAbpTemplate.Application.Contracts.xml
10 |
11 |
12 |
13 | ../IngosAbpTemplate.API/wwwroot/api-doc/IngosAbpTemplate.Application.Contracts.xml
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application.Contracts/IngosAbpTemplateApplicationContractsModule.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Domain.Shared;
2 | using Volo.Abp.Modularity;
3 | using Volo.Abp.ObjectExtending;
4 | using Volo.Abp.PermissionManagement;
5 |
6 | namespace IngosAbpTemplate.Application.Contracts
7 | {
8 | [DependsOn(
9 | typeof(IngosAbpTemplateDomainSharedModule),
10 | typeof(AbpObjectExtendingModule),
11 | typeof(AbpPermissionManagementApplicationContractsModule)
12 | )]
13 | public class IngosAbpTemplateApplicationContractsModule : AbpModule
14 | {
15 | public override void PreConfigureServices(ServiceConfigurationContext context)
16 | {
17 | IngosAbpTemplateDtoExtensions.Configure();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application.Contracts/IngosAbpTemplateDtoExtensions.cs:
--------------------------------------------------------------------------------
1 | using Volo.Abp.Threading;
2 |
3 | namespace IngosAbpTemplate.Application.Contracts
4 | {
5 | public static class IngosAbpTemplateDtoExtensions
6 | {
7 | private static readonly OneTimeRunner OneTimeRunner = new();
8 |
9 | public static void Configure()
10 | {
11 | OneTimeRunner.Run(() =>
12 | {
13 | /* You can add extension properties to DTOs
14 | * defined in the depended modules.
15 | *
16 | * Example:
17 | *
18 | * ObjectExtensionManager.Instance
19 | * .AddOrUpdateProperty("Title");
20 | *
21 | * See the documentation for more:
22 | * https://docs.abp.io/en/abp/latest/Object-Extensions
23 | */
24 | });
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application.Contracts/Permissions/IngosAbpTemplatePermissionDefinitionProvider.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Domain.Shared.Localization;
2 | using Volo.Abp.Authorization.Permissions;
3 | using Volo.Abp.Localization;
4 |
5 | namespace IngosAbpTemplate.Application.Contracts.Permissions
6 | {
7 | public class IngosAbpTemplatePermissionDefinitionProvider : PermissionDefinitionProvider
8 | {
9 | public override void Define(IPermissionDefinitionContext context)
10 | {
11 | var myGroup = context.AddGroup(IngosAbpTemplatePermissions.GroupName);
12 |
13 | //Define your own permissions here. Example:
14 | //myGroup.AddPermission(IngosAbpTemplatePermissions.MyPermission1, L("Permission:MyPermission1"));
15 | }
16 |
17 | private static LocalizableString L(string name)
18 | {
19 | return LocalizableString.Create(name);
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application.Contracts/Permissions/IngosAbpTemplatePermissions.cs:
--------------------------------------------------------------------------------
1 | namespace IngosAbpTemplate.Application.Contracts.Permissions
2 | {
3 | public static class IngosAbpTemplatePermissions
4 | {
5 | public const string GroupName = "IngosAbpTemplate";
6 |
7 | //Add your own permission names. Example:
8 | //public const string MyPermission1 = GroupName + ".MyPermission1";
9 | }
10 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application/BaseAppService.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Domain.Shared.Localization;
2 | using Volo.Abp.Application.Services;
3 |
4 | namespace IngosAbpTemplate.Application
5 | {
6 | ///
7 | /// Inherit your application services from this class.
8 | ///
9 | public abstract class BaseAppService : ApplicationService
10 | {
11 | ///
12 | /// Base application service
13 | ///
14 | protected BaseAppService()
15 | {
16 | LocalizationResource = typeof(IngosAbpTemplateResource);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application/IngosAbpTemplate.Application.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | IngosAbpTemplate.Application
6 |
7 |
8 |
9 | ../IngosAbpTemplate.API/wwwroot/api-doc/IngosAbpTemplate.Application.xml
10 |
11 |
12 |
13 | ../IngosAbpTemplate.API/wwwroot/api-doc/IngosAbpTemplate.Application.xml
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application/IngosAbpTemplateApplicationAutoMapperProfile.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 |
3 | namespace IngosAbpTemplate.Application
4 | {
5 | ///
6 | /// AutoMapper object mapper profile
7 | ///
8 | public class IngosAbpTemplateApplicationAutoMapperProfile : Profile
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Application/IngosAbpTemplateApplicationModule.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Application.Contracts;
2 | using IngosAbpTemplate.Domain;
3 | using Volo.Abp.AutoMapper;
4 | using Volo.Abp.Modularity;
5 | using Volo.Abp.PermissionManagement;
6 |
7 | namespace IngosAbpTemplate.Application
8 | {
9 | ///
10 | /// Application Module
11 | ///
12 | [DependsOn(
13 | typeof(IngosAbpTemplateDomainModule),
14 | typeof(IngosAbpTemplateApplicationContractsModule),
15 | typeof(AbpPermissionManagementApplicationModule)
16 | )]
17 | public class IngosAbpTemplateApplicationModule : AbpModule
18 | {
19 | public override void ConfigureServices(ServiceConfigurationContext context)
20 | {
21 | Configure(options => { options.AddMaps(); });
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/IngosAbpTemplate.Domain.Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | IngosAbpTemplate.Domain.Shared
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/IngosAbpTemplateDomainErrorCodes.cs:
--------------------------------------------------------------------------------
1 | namespace IngosAbpTemplate.Domain.Shared
2 | {
3 | public static class IngosAbpTemplateDomainErrorCodes
4 | {
5 | /* You can add your business exception error codes here, as constants */
6 | }
7 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/IngosAbpTemplateDomainSharedModule.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Domain.Shared.Localization;
2 | using Volo.Abp.AuditLogging;
3 | using Volo.Abp.BackgroundJobs;
4 | using Volo.Abp.Localization;
5 | using Volo.Abp.Localization.ExceptionHandling;
6 | using Volo.Abp.Modularity;
7 | using Volo.Abp.PermissionManagement;
8 | using Volo.Abp.Validation.Localization;
9 | using Volo.Abp.VirtualFileSystem;
10 |
11 | namespace IngosAbpTemplate.Domain.Shared
12 | {
13 | [DependsOn(
14 | typeof(AbpAuditLoggingDomainSharedModule),
15 | typeof(AbpBackgroundJobsDomainSharedModule),
16 | typeof(AbpPermissionManagementDomainSharedModule)
17 | )]
18 | public class IngosAbpTemplateDomainSharedModule : AbpModule
19 | {
20 | public override void PreConfigureServices(ServiceConfigurationContext context)
21 | {
22 | IngosAbpTemplateModuleExtensionConfigurator.Configure();
23 | }
24 |
25 | public override void ConfigureServices(ServiceConfigurationContext context)
26 | {
27 | Configure(options =>
28 | {
29 | options.FileSets.AddEmbedded();
30 | });
31 |
32 | Configure(options =>
33 | {
34 | options.Resources
35 | .Add("zh-Hans")
36 | .AddBaseTypes(typeof(AbpValidationResource))
37 | .AddVirtualJson("/Localization/IngosAbpTemplate");
38 |
39 | options.DefaultResourceType = typeof(IngosAbpTemplateResource);
40 | });
41 |
42 | Configure(options =>
43 | {
44 | options.MapCodeNamespace("IngosAbpTemplate", typeof(IngosAbpTemplateResource));
45 | });
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/IngosAbpTemplateModuleExtensionConfigurator.cs:
--------------------------------------------------------------------------------
1 | using Volo.Abp.Threading;
2 |
3 | namespace IngosAbpTemplate.Domain.Shared
4 | {
5 | public static class IngosAbpTemplateModuleExtensionConfigurator
6 | {
7 | private static readonly OneTimeRunner OneTimeRunner = new();
8 |
9 | public static void Configure()
10 | {
11 | OneTimeRunner.Run(() =>
12 | {
13 | ConfigureExistingProperties();
14 | ConfigureExtraProperties();
15 | });
16 | }
17 |
18 | private static void ConfigureExistingProperties()
19 | {
20 | /* You can change max lengths for properties of the
21 | * entities defined in the modules used by your application.
22 | *
23 | * Example: Change user and role name max lengths
24 |
25 | IdentityUserConsts.MaxNameLength = 99;
26 | IdentityRoleConsts.MaxNameLength = 99;
27 |
28 | * Notice: It is not suggested to change property lengths
29 | * unless you really need it. Go with the standard values wherever possible.
30 | *
31 | * If you are using EF Core, you will need to run the add-migration command after your changes.
32 | */
33 | }
34 |
35 | private static void ConfigureExtraProperties()
36 | {
37 | /* You can configure extra properties for the
38 | * entities defined in the modules used by your application.
39 | *
40 | * This class can be used to define these extra properties
41 | * with a high level, easy to use API.
42 | *
43 | * Example: Add a new property to the user entity of the identity module
44 |
45 | ObjectExtensionManager.Instance.Modules()
46 | .ConfigureIdentity(identity =>
47 | {
48 | identity.ConfigureUser(user =>
49 | {
50 | user.AddOrUpdateProperty( //property type: string
51 | "SocialSecurityNumber", //property name
52 | property =>
53 | {
54 | //validation rules
55 | property.Attributes.Add(new RequiredAttribute());
56 | property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});
57 |
58 | //...other configurations for this property
59 | }
60 | );
61 | });
62 | });
63 |
64 | * See the documentation for more:
65 | * https://docs.abp.io/en/latest/Module-Entity-Extensions
66 | */
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/Localization/IngosAbpTemplate/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "culture": "en",
3 | "texts": {
4 | "Menu:Home": "Home",
5 | "Welcome": "Welcome",
6 | "LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io."
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/Localization/IngosAbpTemplate/zh-Hans.json:
--------------------------------------------------------------------------------
1 | {
2 | "culture": "zh-Hans",
3 | "texts": {
4 | "Menu:Home": "首页",
5 | "Welcome": "欢迎",
6 | "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io."
7 | }
8 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/Localization/IngosAbpTemplate/zh-Hant.json:
--------------------------------------------------------------------------------
1 | {
2 | "culture": "zh-Hant",
3 | "texts": {
4 | "Menu:Home": "首頁",
5 | "Welcome": "歡迎",
6 | "LongWelcomeMessage": "歡迎來到此應用程式. 這是一個基於ABP框架的起始專案. 有關更多訊息, 請瀏覽 abp.io."
7 | }
8 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain.Shared/Localization/IngosAbpTemplateResource.cs:
--------------------------------------------------------------------------------
1 | using Volo.Abp.Localization;
2 |
3 | namespace IngosAbpTemplate.Domain.Shared.Localization
4 | {
5 | [LocalizationResourceName("IngosAbpTemplate")]
6 | public class IngosAbpTemplateResource
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain/IngosAbpTemplate.Domain.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | IngosAbpTemplate.Domain
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Domain/IngosAbpTemplateDomainModule.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Domain.Shared;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Microsoft.Extensions.DependencyInjection.Extensions;
4 | using Volo.Abp.AuditLogging;
5 | using Volo.Abp.BackgroundJobs;
6 | using Volo.Abp.Emailing;
7 | using Volo.Abp.Modularity;
8 | using Volo.Abp.PermissionManagement;
9 |
10 | namespace IngosAbpTemplate.Domain
11 | {
12 | [DependsOn(
13 | typeof(IngosAbpTemplateDomainSharedModule),
14 | typeof(AbpAuditLoggingDomainModule),
15 | typeof(AbpBackgroundJobsDomainModule),
16 | typeof(AbpEmailingModule),
17 | typeof(AbpPermissionManagementDomainModule)
18 | )]
19 | public class IngosAbpTemplateDomainModule : AbpModule
20 | {
21 | public override void ConfigureServices(ServiceConfigurationContext context)
22 | {
23 | #if DEBUG
24 | context.Services.Replace(ServiceDescriptor.Singleton());
25 | #endif
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Infrastructure/EntityConfigurations/Consts.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Danvic.Wang All rights reserved.
4 | //
5 | // Author: Danvic.Wang
6 | // Created DateTime: 2021/3/7 14:40:13
7 | // Modified by:
8 | // Description: Const value of generate database table
9 | //-----------------------------------------------------------------------
10 |
11 | namespace IngosAbpTemplate.Infrastructure.EntityConfigurations
12 | {
13 | public class Consts
14 | {
15 | public const string DbTablePrefix = "T";
16 |
17 | public const string AbpDbTablePrefix = "Abp";
18 |
19 | public const string DbSchema = null;
20 | }
21 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Infrastructure/EntityConfigurations/DbContextFactory.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Danvic.Wang All rights reserved.
4 | //
5 | // Author: Danvic.Wang
6 | // Created DateTime: 2021/2/12 22:27:29
7 | // Modified by:
8 | // Description: EF Core migrations command setting like Add-Migration and Update-Database commands
9 | //-----------------------------------------------------------------------
10 |
11 | using System.IO;
12 | using Microsoft.EntityFrameworkCore;
13 | using Microsoft.EntityFrameworkCore.Design;
14 | using Microsoft.Extensions.Configuration;
15 |
16 | namespace IngosAbpTemplate.Infrastructure.EntityConfigurations
17 | {
18 | public class DbContextFactory : IDesignTimeDbContextFactory
19 | {
20 | public IngosAbpTemplateDbContext CreateDbContext(string[] args)
21 | {
22 | EntityExtraPropertyExtensionMappings.Configure();
23 |
24 | var configuration = BuildConfiguration();
25 |
26 | var connectionString = configuration.GetConnectionString("Default");
27 |
28 | #if MsSQL
29 | var builder = new DbContextOptionsBuilder()
30 | .UseSqlServer(connectionString);
31 | return new IngosAbpTemplateDbContext(builder.Options);
32 | #elif PgSQL
33 | var builder = new DbContextOptionsBuilder()
34 | .UseNpgsql(connectionString);
35 | return new IngosAbpTemplateDbContext(builder.Options);
36 | #else
37 | var builder = new DbContextOptionsBuilder()
38 | .UseMySql(connectionString, ServerVersion.AutoDetect(connectionString));
39 | return new IngosAbpTemplateDbContext(builder.Options);
40 | #endif
41 | }
42 |
43 | private static IConfigurationRoot BuildConfiguration()
44 | {
45 | var builder = new ConfigurationBuilder()
46 | .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../IngosAbpTemplate.API/"))
47 | .AddJsonFile("appsettings.json", false);
48 |
49 | return builder.Build();
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Infrastructure/EntityConfigurations/EntityConfigurationExtensions.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Danvic.Wang All rights reserved.
4 | //
5 | // Author: Danvic.Wang
6 | // Created DateTime: 2021/3/7 14:44:35
7 | // Modified by:
8 | // Description: Entity to table configuration
9 | //-----------------------------------------------------------------------
10 |
11 | using Microsoft.EntityFrameworkCore;
12 | using Volo.Abp;
13 | using Volo.Abp.AuditLogging.EntityFrameworkCore;
14 | using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
15 | using Volo.Abp.PermissionManagement.EntityFrameworkCore;
16 |
17 | namespace IngosAbpTemplate.Infrastructure.EntityConfigurations
18 | {
19 | public static class EntityConfigurationExtensions
20 | {
21 | ///
22 | /// Configure Abp framework own tables/entities
23 | ///
24 | public static void ConfigureAbpEntities(this ModelBuilder builder)
25 | {
26 | Check.NotNull(builder, nameof(builder));
27 |
28 | builder.ConfigureAuditLogging();
29 | builder.ConfigureBackgroundJobs();
30 | builder.ConfigurePermissionManagement();
31 | }
32 |
33 | ///
34 | /// Configure project own tables/entities
35 | ///
36 | public static void ConfigureIngosAbpTemplate(this ModelBuilder builder)
37 | {
38 | Check.NotNull(builder, nameof(builder));
39 |
40 | /* Configure your own tables/entities inside here */
41 |
42 | //builder.Entity(b =>
43 | //{
44 | // b.ToTable(Consts.DbTablePrefix + "YourEntities", Consts.DbSchema);
45 | // b.ConfigureByConvention(); //auto configure for the base class props
46 | // //...
47 | //});
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Infrastructure/EntityConfigurations/EntityExtraPropertyExtensionMappings.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Domain.Shared;
2 | using Volo.Abp.Threading;
3 |
4 | namespace IngosAbpTemplate.Infrastructure.EntityConfigurations
5 | {
6 | public static class EntityExtraPropertyExtensionMappings
7 | {
8 | private static readonly OneTimeRunner OneTimeRunner = new();
9 |
10 | public static void Configure()
11 | {
12 | IngosAbpTemplateModuleExtensionConfigurator.Configure();
13 |
14 | OneTimeRunner.Run(() =>
15 | {
16 | /* You can configure extra properties for the
17 | * entities defined in the modules used by your application.
18 | *
19 | * This class can be used to map these extra properties to table fields in the database.
20 | *
21 | * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING.
22 | * USE IngosAbpTemplateModuleExtensionConfigurator CLASS (in the Domain.Shared project)
23 | * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES
24 | *
25 | * Example: Map a property to a table field:
26 |
27 | ObjectExtensionManager.Instance
28 | .MapEfCoreProperty(
29 | "MyProperty",
30 | (entityBuilder, propertyBuilder) =>
31 | {
32 | propertyBuilder.HasMaxLength(128);
33 | }
34 | );
35 |
36 | * See the documentation for more:
37 | * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
38 | */
39 | });
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Infrastructure/IngosAbpTemplate.Infrastructure.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 |
6 |
7 |
8 |
9 |
10 | all
11 | runtime; build; native; contentfiles; analyzers; buildtransitive
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Infrastructure/IngosAbpTemplateDbContext.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Infrastructure.EntityConfigurations;
2 | using Microsoft.EntityFrameworkCore;
3 | using Volo.Abp.Data;
4 | using Volo.Abp.EntityFrameworkCore;
5 |
6 | namespace IngosAbpTemplate.Infrastructure
7 | {
8 | /* This is your actual DbContext used on runtime.
9 | * It includes only your entities.
10 | * It does not include entities of the used modules, because each module has already
11 | * its own DbContext class. If you want to share some database tables with the used modules,
12 | * just create a structure like done for AppUser.
13 | *
14 | * Don't use this DbContext for database migrations since it does not contain tables of the
15 | * used modules (as explained above). See IngosAbpTemplateMigrationsDbContext for migrations.
16 | */
17 |
18 | [ConnectionStringName("Default")]
19 | public class IngosAbpTemplateDbContext : AbpDbContext
20 | {
21 | /* Add DbSet properties for your Aggregate Roots / Entities here.
22 | * Also map them inside IngosAbpTemplateDbContextModelCreatingExtensions.ConfigureIngosAbpTemplate
23 | */
24 |
25 | public IngosAbpTemplateDbContext(DbContextOptions options)
26 | : base(options)
27 | {
28 | }
29 |
30 | protected override void OnModelCreating(ModelBuilder builder)
31 | {
32 | base.OnModelCreating(builder);
33 |
34 | /* Configure the shared tables (with included modules) here */
35 | builder.ConfigureAbpEntities();
36 |
37 | /* Configure your own tables/entities inside the ConfigureIngosAbpTemplate method */
38 | builder.ConfigureIngosAbpTemplate();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/templates/src/IngosAbpTemplate.Infrastructure/IngosAbpTemplateInfrastructureModule.cs:
--------------------------------------------------------------------------------
1 | using IngosAbpTemplate.Domain;
2 | using IngosAbpTemplate.Infrastructure.EntityConfigurations;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Volo.Abp.AuditLogging.EntityFrameworkCore;
5 | using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
6 | using Volo.Abp.EntityFrameworkCore;
7 | using Volo.Abp.EntityFrameworkCore.MySQL;
8 | using Volo.Abp.Modularity;
9 | using Volo.Abp.PermissionManagement.EntityFrameworkCore;
10 | using Volo.Abp.Uow;
11 |
12 | #if MsSQL
13 | using Volo.Abp.EntityFrameworkCore.SqlServer;
14 | #elif PgSQL
15 | using Volo.Abp.EntityFrameworkCore.PostgreSql;
16 | #else
17 | #endif
18 |
19 | namespace IngosAbpTemplate.Infrastructure
20 | {
21 | [DependsOn(
22 | typeof(IngosAbpTemplateDomainModule),
23 | #if MsSQL
24 | typeof(AbpEntityFrameworkCoreSqlServerModule),
25 | #elif PgSQL
26 | typeof(AbpEntityFrameworkCorePostgreSqlModule),
27 | #else
28 | typeof(AbpEntityFrameworkCoreMySQLModule),
29 | #endif
30 | typeof(AbpUnitOfWorkModule),
31 | typeof(AbpBackgroundJobsEntityFrameworkCoreModule),
32 | typeof(AbpAuditLoggingEntityFrameworkCoreModule),
33 | typeof(AbpPermissionManagementEntityFrameworkCoreModule)
34 | )]
35 | public class IngosAbpTemplateInfrastructureModule : AbpModule
36 | {
37 | public override void PreConfigureServices(ServiceConfigurationContext context)
38 | {
39 | EntityExtraPropertyExtensionMappings.Configure();
40 | }
41 |
42 | public override void ConfigureServices(ServiceConfigurationContext context)
43 | {
44 | context.Services.AddAbpDbContext(options =>
45 | {
46 | /* Remove "includeAllEntities: true" to create
47 | * default repositories only for aggregate roots */
48 | options.AddDefaultRepositories(true);
49 | });
50 |
51 | Configure(options =>
52 | {
53 | #if MsSQL
54 | options.UseSqlServer();
55 | #elif PgSQL
56 | options.UseNpgsql();
57 | #else
58 | options.UseMySQL();
59 | #endif
60 | });
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/version:
--------------------------------------------------------------------------------
1 | 1.0.7
--------------------------------------------------------------------------------