{"id":27610392,"url":"https://github.com/aspnetrun/run-aspnetcore-basics_retired","last_synced_at":"2025-04-22T23:27:23.344Z","repository":{"id":40883488,"uuid":"182988060","full_name":"aspnetrun/run-aspnetcore-basics_retired","owner":"aspnetrun","description":"One Solution - One Project for web application development with Asp.Net Core \u0026 EF.Core. Only one web application project which used aspnetcore components; razor pages, middlewares, dependency injection, configuration, logging. To create websites with minimum implementation of asp.net core based on HTML5, CSS, and JavaScript. You can use this boilerplate for fast implementation, minimum development, bootstrap your idea, create Minimum Viable Product (MVP), idea validation, startup development implementation for a limited time and limited resources with using latest asp.net core and entity framework core.","archived":false,"fork":false,"pushed_at":"2023-03-03T23:29:07.000Z","size":824,"stargazers_count":16,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-21T10:00:31.436Z","etag":null,"topics":["aspnet-core","aspnet-core-template","aspnetcore","clean-code","code-first","crud-application","crud-sample","csharp","dotnet-core","ef-core","entity-framework-core","idea-generator","razor-pages","starter-kit","starter-project","starter-template","starterkit","visual-studio","web-application-development"],"latest_commit_sha":null,"homepage":"https://aspnetrun.azurewebsites.net/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aspnetrun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-23T10:06:54.000Z","updated_at":"2024-02-12T06:51:32.000Z","dependencies_parsed_at":"2023-01-25T06:45:41.868Z","dependency_job_id":null,"html_url":"https://github.com/aspnetrun/run-aspnetcore-basics_retired","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aspnetrun%2Frun-aspnetcore-basics_retired","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aspnetrun%2Frun-aspnetcore-basics_retired/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aspnetrun%2Frun-aspnetcore-basics_retired/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aspnetrun%2Frun-aspnetcore-basics_retired/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aspnetrun","download_url":"https://codeload.github.com/aspnetrun/run-aspnetcore-basics_retired/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250339390,"owners_count":21414353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnet-core","aspnet-core-template","aspnetcore","clean-code","code-first","crud-application","crud-sample","csharp","dotnet-core","ef-core","entity-framework-core","idea-generator","razor-pages","starter-kit","starter-project","starter-template","starterkit","visual-studio","web-application-development"],"created_at":"2025-04-22T23:27:22.737Z","updated_at":"2025-04-22T23:27:23.336Z","avatar_url":"https://github.com/aspnetrun.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is AspnetRun ? \nA **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...) \nand aimed to be a **Clean Architecture**, with applying **SOLID principles** in order to use for a project template. \nAlso 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.\n\nYou can check full repository documentations and step by step development of **[100+ page e-book PDF](https://aspnetrun.azurewebsites.net/Discover)** from here - **https://aspnetrun.azurewebsites.net/Discover**. Also detail introduction of book and project structure exists on **[medium aspnetrun page](https://medium.com/aspnetrun)**. You can follow **aspnetrun repositories** for building **step by step** asp.net core **web development skills**.\n\n# AspnetRun Repositories\nHere you can find all of the **aspnetrun repositories from easy to difficult**, Also this list can be track a **learning path** of asp.net core respectively;\n* **[run-aspnetcore-basic](https://github.com/aspnetrun/run-aspnetcore-basic)** - intended to building fastest ASP.NET Core Default Web Application template. This solution **only one solution one project** for **idea generation** with Asp.Net Core. \n* **[run-aspnetcore](https://github.com/aspnetrun/run-aspnetcore)** - intended to building Multi-Page Web Applications(MPA) using ASP.NET Core \u0026 EF.Core in **Clean Architecture** with default aspnet core server-side rendering approach.\n* **[run-aspnetcore-angular](https://github.com/aspnetrun/run-angular)** - intended to building Single-Page Web Applications(SPA) using ASP.NET Core \u0026 EF.Core, Web API Project and **Angular** for frontend framework.\n\nAnd there are crucial repositories which are **implemented base repository** and **applying real-world examples** with developing new enterprice features for example Identity, Paging, Localization etc..\n* **[run-aspnetcore-basic-realworld](https://github.com/aspnetrun/run-aspnetcore-basic-realworld)** - implemented this repository and build **sample of eCommerce reference application** on Default ASP.NET Core in a **one solution one project for fastest idea implementations**.\n* **[run-aspnetcore-realworld](https://github.com/aspnetrun/run-aspnetcore-realworld)** - implemented run-aspnetcore repository and build **sample of eCommerce reference application** on Multi-Page Web Applications(MPA) using ASP.NET Core Razor Pages templates.\n* **[run-aspnetcore-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**.\n\nThese repositories are **updated regularly**. We are following Microsoft Web Technologies very closely so we will update all these repositories accordingly with **Microsoft Web Application stacks**.\n\n# run-aspnetcore-basic\nHere is CRUD operations of aspnetrun-core-basic template project;\n\n![Recordit GIF](http://g.recordit.co/LJCyYfQEpX.gif)\n\nAspnetRunBasic has only **one solution** and into this solution only **one web application project** with Asp.Net Core \u0026 EF.Core which used aspnetcore components; **razor pages, middlewares, dependency injection, configuration, logging**. To create websites with minimum implementation of asp.net core based on **HTML5, CSS, and JavaScript**. You can use this boilerplate for **fast implementation, minimum development, bootstrap your idea, create Minimum Viable Product (MVP), idea validation, startup development** implementation for a limited time and limited resources with using latest asp.net core and entity framework core.\n\n## Give a Star! :star:\nIf 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**.\n\n## Getting Started\nUse these instructions to get the project up and running.\n\n### Prerequisites\nYou will need the following tools:\n\n* [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/)\n* [.Net Core 3.0 or later](https://dotnet.microsoft.com/download/dotnet-core/2.2)\n* EF Core 3.0 or later\n\n### Installing\nFollow these steps to get your development environment set up:\n1. Clone the repository\n2. At the root directory, restore required packages by running:\n```csharp\ndotnet restore\n```\n3. Next, build the solution by running:\n```csharp\ndotnet build\n```\n4. Next, within the AspnetRun.Web directory, launch the back end by running:\n```csharp\ndotnet run\n```\n5. Launch http://localhost:5400/ in your browser to view the Web UI.\n\nIf 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.\n\n### Usage\nAfter 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\"**.\nIf 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).\n\n```csharp\npublic void ConfigureDatabases(IServiceCollection services)\n{\n            //// use in-memory database\n            //services.AddDbContext\u003cAspnetRunContext\u003e(c =\u003e\n            //    c.UseInMemoryDatabase(\"AspnetRunConnection\"));\n\n            // add real database dependecy\n            services.AddDbContext\u003cAspnetRunContext\u003e(c =\u003e\n                c.UseSqlServer(Configuration.GetConnectionString(\"AspnetRunConnection\")));  \n}\n```\n\n1. Ensure your connection strings in ```appsettings.json``` point to a local SQL Server instance.\n\n2. Open a command prompt in the Web folder and execute the following commands:\n\n```csharp\ndotnet restore\ndotnet ef database update -c AspnetRunContext\n```\nOr 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;\n```csharp\nupdate-database\n```\nThese commands will create aspnetrun database which include Product and Category table. You can see from **AspnetRunContext.cs**.\n1. Run the application.\nThe 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.\n\nIf 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;\n```csharp\nadd-migration YourCustomEntityChanges\nupdate-database\n```\n\n### Structure of Project\n**run-aspnetcore-basic** is a general purpose to implement the **Default Web Application template of .Net** with **one solution one project for fastest idea implementations** to building modern web applications with latest ASP.NET Core \u0026 EF Core technologies. \n\nRepository include folders for group implementations;\n* Data\n    * AspnetRunContext    \n    * AspnetRunContextSeed    \n* Entities\n    * Product    \n    * Category    \n* Migrations\n    * Generated by scaffolding from ef.core    \n* Pages\n    * Default Razor Web Application Template of Asp.Net Core\n* Repositories\n    * IProductRepository\n    * ProductRepository\n* wwwroot\n* Startup.cs\n* Program.cs\n    \n### Data Folder\nIncludes **Entity Framework Core Context** and tables in this folder. When new entity created, it should add to context and configure in context.\nThe 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. \n\n#### Migrations\nEF add-migration classes.\n#### Repository\nEF Repository implementation. This class responsible to create queries, includes, where conditions etc..\n\n### Entities Folder\nIncludes Entity Framework Core Entities which creates sql table with **Entity Framework Core Code First Aproach**. Some Aggregate folders holds entity and aggregates.\nYou can see example of **code-first** Entity definition as below;\n\n```csharp\npublic class Product\n    {\n        public int Id { get; set; }\n\n        [Required, StringLength(80)]\n        public string Name { get; set; }\n\n        [Required, StringLength(255)]\n        public string Description { get; set; }\n\n        public int UnitPrice { get; set; }        \n\n        public int CategoryId { get; set; }\n        public Category Category { get; set; }\n    }\n```\n\n### Repository Folder\nImplementation of Core interfaces in this project with **Entity Framework Core** and other dependencies.\nMost 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.\nThis 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.\n\n```csharp\npublic interface IProductRepository\n    {\n        Task\u003cIEnumerable\u003cProduct\u003e\u003e GetProductListAsync();\n        Task\u003cProduct\u003e GetProductByIdAsync(int id);\n        Task\u003cIEnumerable\u003cProduct\u003e\u003e GetProductByNameAsync(string name);\n        Task\u003cIEnumerable\u003cProduct\u003e\u003e GetProductByCategoryAsync(int categoryId);\n        Task\u003cProduct\u003e AddAsync(Product product);\n        Task UpdateAsync(Product product);\n        Task DeleteAsync(Product product);\n        Task\u003cIEnumerable\u003cCategory\u003e\u003e GetCategories();\n    }\n```\nAlso implementation located same places in order to choose different implementation at runtime when DI bootstrapped.\n```csharp\n public class ProductRepository : IProductRepository\n    {\n        protected readonly AspnetRunContext _dbContext;\n\n        public ProductRepository(AspnetRunContext dbContext)\n        {\n            _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));\n        }\n\n        public async Task\u003cIEnumerable\u003cProduct\u003e\u003e GetProductListAsync()\n        {\n            return await _dbContext.Products.ToListAsync();\n        }\n\n        public async Task\u003cProduct\u003e GetProductByIdAsync(int id)\n        {\n            return await _dbContext.Products\n                .Include(p =\u003e p.Category)\n                .FirstOrDefaultAsync(p =\u003e p.Id == id);\n        }\n```\n\n\n### Pages Folder\nDevelopment of UI Logic with implementation. Interfaces drives business requirements and implementations in this layer.\nThe 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.\n\n#### Used Components\n* Asp.Net Core\n* Entity Framework Core\n* Razor Pages\n    * Scaffolding Razor\n    * Tag Helpers\n    * Bindings\n    * Model Validations\n    * Navigation - Page Routes\n    * User Interfaces\n    * Partial Views\n    * View Components\n    * Razor Sections\n    * Dynamic Layout\n* Middlewares\n* Logging\n* Configuration\n* Dependency Injection\n\n***Most of these features implemented on real-world repository of this repos.Check for real-world examples.\n\n### wwwroot Folder\nThe wwwroot folder in the ASP.NET Core project is treated as a web root folder. Static files can be stored in any folder under the web root and accessed with a relative path to that root.\n\nIn the standard ASP.NET application, static files can be served from the root folder of an application or any other folder under it. This has been changed in ASP.NET Core. Now, only those files that are in the web root - wwwroot folder can be served over an http request. All other files are blocked and cannot be served by default.\n\n### Program.cs\nASP.NET Core web application is actually a console project which starts executing from the entry point public static void Main() in Program class where we can create a host for the web application.\n\n### Startup.cs\nASP.NET Core application must include Startup class. It is like Global.asax in the traditional .NET application. As the name suggests, it is executed first when the application starts.\n\n\n## Technologies\n* .NET Core 3.0\n* ASP.NET Core 3.0\n* Entity Framework Core 3.0 \n* .NET Core Native DI\n* Razor Pages\n* AutoMapper\n\n## Main Objects\n* Asp.Net Core\n* Entity Framework Core\n* Razor Pages   \n* Repository Design Pattern\n* Multiple Page Web Application (MPA)\n* Monolitic Deployment Architecture\n* SOLID and Clean Code\n\n## Disclaimer\n\n* This repository is not intended to be a definitive solution.\n* This repository not implemented a lot of 3rd party packages, we are try to avoid the over engineering when building on best practices.\n* Beware to use in production way.\n\n## Contributing\n\nPlease 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.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/aspnetrun/run-core/tags). \n\n## Next Releases and RoapMap\n\nFor information on upcoming features and fixes, take a look at the [product roadmap](https://github.com/aspnetrun/run-core/projects).\n\n## Deployment - AspnetRun Online\n\nThis project is deployed on Azure. See the project running on Azure in [here](aspnetrun.com).\n\n## Pull-Request\n\nPlease fork this repository, and send me your findings with pull-requests. This is open-source repository so open to contributions.\n\n## Authors\n\n* **Mehmet Ozkaya** - *Initial work* - [mehmetozkaya](https://github.com/mehmetozkaya)\n\nSee also the list of [contributors](https://github.com/aspnetrun/run-core/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faspnetrun%2Frun-aspnetcore-basics_retired","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faspnetrun%2Frun-aspnetcore-basics_retired","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faspnetrun%2Frun-aspnetcore-basics_retired/lists"}