You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
-334Lines changed: 0 additions & 334 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -354,22 +354,6 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md
354
354
-------------------------------
355
355
356
356
357
-
# What is AspnetRun ?
358
-
A **starter kit** for your next **ASP.NET Core** web application. Boilerplate for **ASP.NET Core reference application** with **Entity Framework Core**, demonstrating a layered application architecture with DDD best practices. Implements NLayer **Hexagonal architecture** (Core, Application, Infrastructure and Presentation Layers) and **Domain Driven Design** (Entities, Repositories, Domain/Application Services, DTO's...)
359
-
and aimed to be a **Clean Architecture**, with applying **SOLID principles** in order to use for a project template.
360
-
Also implements **best practices** like **loosely-coupled, dependency-inverted** architecture and using **design patterns** such as **Dependency Injection**, logging, validation, exception handling, localization and so on.
361
-
362
-
You can check full repository documentations and step by step development of **[100+ page eBook PDF](http://www.aspnetrun.com/Book)** from here - **http://www.aspnetrun.com/Book**. Also detail introduction of book and project structure exists on **[50+ page of github wiki](https://github.com/aspnetrun/run-core/wiki)**.
363
-
364
-
# AspnetRun Repositories
365
-
There are **2 types** of aspnetrun repositories;
366
-
***[run-aspnetcore](https://github.com/aspnetrun/run-aspnetcore)** - intented to building traditional Multi-Page Web Applications(MPA) using ASP.NET Core & EF.Core and **Razor Pages** templates with default aspnet core server-side rendering approach.
367
-
***[run-angular](https://github.com/aspnetrun/run-angular)** - intented to building Single-Page Web Applications(SPA) using ASP.NET Core & EF.Core, Web API Project and **Angular** for frontend framework. **YOU ARE HERE.**
368
-
369
-
And there are 2 sample repositories which are implemented base repository and **applying real-world examples** with developing new features for example Identity, Localization etc..
370
-
***[run-aspnetcore-realworld](https://github.com/aspnetrun/run-aspnetcore-realworld)** - implemented this repository and build **sample of eCommerce reference application** on Multi-Page Web Applications(MPA) using ASP.NET Core Razor Pages templates.
371
-
***[run-angular-realworld](https://github.com/aspnetrun/run-angular-realworld)** - implemented run-angular repository and build **sample of eCommerce reference application** on Single Page Web Application(SPA) architecture using **ASP.NET Core + Angular**.
372
-
373
357
# run-angular
374
358
This repository is ***under development***. It is not finished yet.
375
359
It will include;
@@ -390,321 +374,3 @@ Here is CRUD operations of aspnetrun-core template project;
390
374
391
375
We are following Microsoft Web Technologies very closely so we will update all these repositories accordingly with **Microsoft Web Application stacks**.
392
376
393
-
## Give a Star! :star:
394
-
If you liked the project or if AspnetRun helped you, please **give a star**. And also please **fork** this repository and send us **pull-requests**. If you find any problem please open **issue**.
395
-
396
-
## Getting Started
397
-
Use these instructions to get the project up and running.
398
-
399
-
### Prerequisites
400
-
You will need the following tools:
401
-
402
-
*[Visual Studio 2019](https://visualstudio.microsoft.com/downloads/)
403
-
*[.Net Core 2.2 or later](https://dotnet.microsoft.com/download/dotnet-core/2.2)
404
-
* EF Core 2.2 or later
405
-
406
-
### Installing
407
-
Follow these steps to get your development environment set up:
408
-
1. Clone the repository
409
-
2. At the root directory, restore required packages by running:
410
-
```csharp
411
-
dotnetrestore
412
-
```
413
-
3. Next, build the solution by running:
414
-
```csharp
415
-
dotnetbuild
416
-
```
417
-
4. Next, within the AspnetRun.Web directory, launch the back end by running:
418
-
```csharp
419
-
dotnetrun
420
-
```
421
-
5. Launch http://localhost:5400/ in your browser to view the Web UI.
422
-
423
-
If you have **Visual Studio** after cloning Open solution with your IDE, AspnetRun.Web should be the start-up project. Directly run this project on Visual Studio with **F5 or Ctrl+F5**. You will see index page of project, you can navigate product and category pages and you can perform crud operations on your browser.
424
-
425
-
### Usage
426
-
After cloning or downloading the sample you should be able to run it using an In Memory database immediately. The default configuration of Entity Framework Database is **"InMemoryDatabase"**.
427
-
If you wish to use the project with a persistent database, you will need to run its Entity Framework Core **migrations** before you will be able to run the app, and update the ConfigureDatabases method in **Startup.cs** (see below).
Or you can direct call ef commands from Visual Studio **Package Manager Console**. Open Package Manager Console, set default project to AspnetRun.Infrastructure and run below command;
453
-
```csharp
454
-
update-database
455
-
```
456
-
These commands will create aspnetrun database which include Product and Category table. You can see from **AspnetRunContext.cs**.
457
-
1. Run the application.
458
-
The first time you run the application, it will seed aspnetrun sql server database with a few data such that you should see products and categories.
459
-
460
-
If you modify-change or add new some of entities to Core project, you should run ef migrate commands in order to update your database as the same way but below commands;
461
-
```csharp
462
-
addmigrationYourCustomEntityChanges
463
-
update-database
464
-
```
465
-
466
-
## Layered Architecture
467
-
AspnetRun implements NLayer **Hexagonal architecture** (Core, Application, Infrastructure and Presentation Layers) and **Domain Driven Design** (Entities, Repositories, Domain/Application Services, DTO's...). Also implements and provides a good infrastructure to implement **best practices** such as Dependency Injection, logging, validation, exception handling, localization and so on.
468
-
Aimed to be a **Clean Architecture** also called **Onion Architecture**, with applying **SOLID principles** in order to use for a project template. Also implements and provides a good infrastructure to implement **best practices** like **loosely-coupled, dependency-inverted** architecture
469
-
The below image represents aspnetrun approach of development architecture of run repository series;
Repository include layers divided by **4 project**;
475
-
* Core
476
-
* Entities
477
-
* Interfaces
478
-
* Specifications
479
-
* ValueObjects
480
-
* Exceptions
481
-
* Application
482
-
* Interfaces
483
-
* Services
484
-
* Dtos
485
-
* Mapper
486
-
* Exceptions
487
-
* Infrastructure
488
-
* Data
489
-
* Repository
490
-
* Services
491
-
* Migrations
492
-
* Logging
493
-
* Exceptions
494
-
* Web
495
-
* Interfaces
496
-
* Services
497
-
* Pages
498
-
* ViewModels
499
-
* Extensions
500
-
* Mapper
501
-
502
-
### Core Layer
503
-
Development of Domain Logic with abstraction. Interfaces drives business requirements with light implementation. The Core project is the **center of the Clean Architecture** design, and all other project dependencies should point toward it.
504
-
505
-
#### Entities
506
-
Includes Entity Framework Core Entities which creates sql table with **Entity Framework Core Code First Aproach**. Some Aggregate folders holds entity and aggregates.
507
-
You can see example of **code-first** Entity definition as below;
Applying domain driven approach, Product class responsible to create Product instance.
540
-
541
-
#### Interfaces
542
-
Abstraction of Repository - Domain repositories (IAsyncRepository - IProductRepository) - Specifications etc.. This interfaces include database operations without any application and ui responsibilities.
543
-
544
-
#### Specifications
545
-
This folder is implementation of **[specification pattern](https://en.wikipedia.org/wiki/Specification_pattern)**. Creates custom scripts with using **ISpecification** interface. Using BaseSpecification managing Criteria, Includes, OrderBy, Paging.
546
-
This specs runs when EF commands working with passing spec. This specs implemented SpecificationEvaluator.cs and creates query to AspnetRunRepository.cs in ApplySpecification method.This helps create custom queries.
547
-
548
-
### Infrastructure Layer
549
-
Implementation of Core interfaces in this project with **Entity Framework Core** and other dependencies.
550
-
Most of your application's dependence on external resources should be implemented in classes defined in the Infrastructure project. These classes must implement the interfaces defined in Core. If you have a very large project with many dependencies, it may make sense to have more than one Infrastructure project (eg Infrastructure.Data), but in most projects one Infrastructure project that contains folders works well.
551
-
This could be includes, for example, **e-mail providers, file access, web api clients**, etc. For now this repository only dependend sample data access and basic domain actions, by this way there will be no direct links to your Core or UI projects.
552
-
553
-
#### Data
554
-
Includes **Entity Framework Core Context** and tables in this folder. When new entity created, it should add to context and configure in context.
555
-
The Infrastructure project depends on Microsoft.**EntityFrameworkCore.SqlServer** and EF.Core related nuget packages, you can check nuget packages of Infrastructure layer. If you want to change your data access layer, it can easily be replaced with a lighter-weight ORM like Dapper.
556
-
557
-
#### Migrations
558
-
EF add-migration classes.
559
-
#### Repository
560
-
EF Repository and Specification implementation. This class responsible to create queries, includes, where conditions etc..
561
-
#### Services
562
-
Custom services implementation, like email, cron jobs etc.
563
-
564
-
### Application Layer
565
-
Development of **Domain Logic with implementation**. Interfaces drives business requirements and implementations in this layer.
566
-
Application layer defines that user required actions in app services classes as below way;
In this layer we can add validation , authorization, logging, exception handling etc. -- cross cutting activities should be handled in here.
602
-
603
-
### Web Layer
604
-
Development of UI Logic with implementation. Interfaces drives business requirements and implementations in this layer.
605
-
The application's main **starting point** is the ASP.NET Core web project. This is a classical console application, with a public static void Main method in Program.cs. It currently uses the default **ASP.NET Core project template** which based on **Razor Pages** templates. This includes appsettings.json file plus environment variables in order to stored configuration parameters, and is configured in Startup.cs.
606
-
607
-
Web layer defines that user required actions in page services classes as below way;
For each layer, there is a test project which includes intended layer dependencies and mock classes. So that means Core-Application-Infrastructure and Web layer has their own test layer. By this way this test projects also divided by **unit, functional and integration tests** defined by in which layer it is implemented.
654
-
Test projects using **xunit and Mock libraries**. xunit, because that's what ASP.NET Core uses internally to test the product. Moq, because perform to create fake objects clearly and its very modular.
655
-
656
-
657
-
## Technologies
658
-
* .NET Core 2.2
659
-
* ASP.NET Core 2.2
660
-
* Entity Framework Core 2.2
661
-
* .NET Core Native DI
662
-
* Razor Pages
663
-
* AutoMapper
664
-
665
-
## Architecture
666
-
* Clean Architecture
667
-
* Full architecture with responsibility separation of concerns
668
-
* SOLID and Clean Code
669
-
* Domain Driven Design (Layers and Domain Model Pattern)
670
-
* Unit of Work
671
-
* Repository and Generic Repository
672
-
* Multiple Page Web Application (MPA)
673
-
* Monolitic Deployment Architecture
674
-
* Specification Pattern
675
-
676
-
## Disclaimer
677
-
678
-
* This repository is not intended to be a definitive solution.An aspnet application template for angular framework.
679
-
* This repository not implemented a lot of 3rd party packages, we are try to avoid the over engineering when building on best practices.
680
-
* Beware to use in production way.
681
-
682
-
## Contributing
683
-
684
-
Please read [Contributing.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
685
-
686
-
## Versioning
687
-
688
-
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/aspnetrun/run-core/tags).
689
-
690
-
## Next Releases and RoapMap
691
-
692
-
For information on upcoming features and fixes, take a look at the [product roadmap](https://github.com/aspnetrun/run-core/projects).
693
-
694
-
## Deployment - AspnetRun Online
695
-
696
-
This project is deployed on Azure. See the project running on Azure in [here](aspnetrun.com).
697
-
698
-
## Pull-Request
699
-
700
-
Please fork this repository, and send me your findings with pull-requests. This is open-source repository so open to contributions.
0 commit comments