Asp.net Zero Github Official

Since ASP.NET Zero is a proprietary framework (the source code is not publicly hosted on GitHub, though they use private repositories for distribution), I cannot link you to a specific open-source repository. However, I can guide you through the standard ASP.NET Zero Feature Development Workflow . This framework relies heavily on the ASP.NET Boilerplate architecture, so preparing a feature follows a strict, layered approach. Here is a guide to "Preparing a Feature" in ASP.NET Zero, structured like a GitHub contribution guide.

🚀 Feature Implementation Guide: "Phone Book" Example In ASP.NET Zero, developing a feature is not just writing code; it is about following the DDD (Domain-Driven Design) layers. Phase 1: Database & Entity Layer (Core) First, define the data structure.

Create Entity: Go to the .Core project. Create a folder (e.g., PhoneBook ) and add an Entity class inheriting from Entity . // Core/PhoneBook/Person.cs public class Person : Entity<long> { public string Name { get; set; } public string Surname { get; set; } public string EmailAddress { get; set; } }

Add to DbContext: Go to EntityFrameworkCore project, open YourProjectDbContext.cs , and add a DbSet . public DbSet<Person> Persons { get; set; } asp.net zero github

Database Migration: Open Package Manager Console, select the .EntityFrameworkCore project as default, and run: Add-Migration "Added_Person_Entity" Update-Database

Phase 2: Application Layer (Logic & API) This layer handles business logic and exposes DTOs (Data Transfer Objects).

Create DTOs: In the .Application.Shared project, create DTOs. public class PersonDto : EntityDto<long> { public string Name { get; set; } public string Surname { get; set; } public string EmailAddress { get; set; } } Since ASP

Define Interface: In .Application.Shared , define the service interface inheriting from IAsyncCrudAppService (this gives you Get, GetAll, Create, Update, Delete methods automatically). public interface IPersonAppService : IAsyncCrudAppService<PersonDto, long, PagedResultRequestDto, CreatePersonInput, UpdatePersonInput> { }

Implement Service: In the .Application project, implement the interface. public class PersonAppService : AsyncCrudAppService<Person, PersonDto, long, PagedResultRequestDto, CreatePersonInput, UpdatePersonInput>, IPersonAppService { public PersonAppService(IRepository<Person, long> repository) : base(repository) { } }

Phase 3: Presentation Layer (UI) ASP.NET Zero provides two UI frameworks. You usually implement one or both. Option A: Angular UI Here is a guide to "Preparing a Feature" in ASP

Generate Proxy: The backend is now exposing an API. To consume it in Angular, open the terminal in the Angular folder and run: nswag swagger/refresh

This auto-generates a TypeScript service file ( person.service.ts ) in the shared/service-proxies folder. Create Component: Create a new component (e.g., app/main/phonebook ). Routing: Add the route to app-routing.module.ts . Permission: Add a permission name constant in AppPermissions.cs (Core) and permission-names.ts (Angular).

Telegram
Нажмите и вступайте в наше Telegram-сообщество прямо сейчас!
Получите больше