You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/docs/en/Tutorials/Part-6.md

2.9 KiB

Web Application Development Tutorial - Part 6: Authors

//[doc-params]
{
    "UI": ["MVC","NG"],
    "DB": ["EF","Mongo"]
}

{{ if UI == "MVC" UI_Text="mvc" else if UI == "NG" UI_Text="angular" else UI_Text="?" end if DB == "EF" DB_Text="Entity Framework Core" else if DB == "Mongo" DB_Text="MongoDB" else DB_Text="?" end }}

About This Tutorial

In this tutorial series, you will build an ABP based web application named Acme.BookStore. This application is used to manage a list of books and their authors. It is developed using the following technologies:

  • {{DB_Text}} as the ORM provider.
  • {{UI_Value}} as the UI Framework.

This tutorial is organized as the following parts;

Download the Source Code

This tutorials has multiple versions based on your UI and Database preferences. We've prepared two combinations of the source code to be downloaded:

Introduction

In the previous parts, we've used the ABP infrastructure to easily build some services;

For the "Authors" part, we will do most of the things manually to show how you can do it in case of need.

The Author Entity

Create an Authors folder (namespace) in the Acme.BookStore.Domain project and add an Author class inside it:

using System;
using Volo.Abp.Domain.Entities.Auditing;

namespace Acme.BookStore.Authors
{
    public class Author : FullAuditedAggregateRoot<Guid>
    {
        public string Name { get; internal set; }

        public DateTime BirthDate { get; set; }

        public string ShortBio { get; set; }
    }
}
  • Inherited from FullAuditedAggregateRoot<Guid> which makes the entity soft delete (that means when you delete it, it is not deleted in the database, but just marked as deleted) with all the auditing properties.
  • internal set for the Name property restricts to set this property from out of the domain layer. Because we want to change it in a controlled way in the domain layer to prevent to create two authors with the same name, to just demonstrate a simple business rule.