@ -139,6 +139,55 @@ When you look at your database, you can see that the `Department` table has been

> It's good to have some initial data in the database before running the application. This section introduces the [Data Seeding](https://docs.abp.io/en/abp/latest/Data-Seeding) system of the ABP framework. You can skip this section if you don't want to create the data seeding, but it is suggested to follow along and learn this useful ABP Framework feature.
Create a class deriving from the `IDataSeedContributor` in the `IdentityRelationship.Domain` project by copying the following code:
```csharp
using System;
using System.Threading.Tasks;
using IdentityRelationship.Departments;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace IdentityRelationship;
public class IdentityRelationshipDataSeederContributor
public IdentityRelationshipDataSeederContributor(IRepository<Department,Guid> departmentRepository)
{
_departmentRepository = departmentRepository;
}
public async Task SeedAsync(DataSeedContext context)
{
if (await _departmentRepository.GetCountAsync() <= 0)
{
await _departmentRepository.InsertAsync(
new Department
{
Name = "Human Resources"
},
autoSave: true
);
await _departmentRepository.InsertAsync(
new Department
{
Name = "Production"
},
autoSave: true
);
}
}
}
```
- This code simply uses the `IRepository<Department, Guid>` (the default [repository](https://docs.abp.io/en/abp/latest/Repositories)) to insert two books to the database in case there weren't any books in it.
Again, open the `IdentityRelationshipModuleExtensionConfigurator` class in the Domain.Shared project and add the following code:
`DepartmentAppService `is using the `ObjectMapper` to convert the `Department` objects to `DepartmentDto` objects. So, we need to define this mapping in the AutoMapper configuration.
Open the `IdentityRelationshipApplicationAutoMapperProfile` class inside the `IdentityRelationship.Application` project and add the following line to the constructor:
```csharp
using AutoMapper;
using IdentityRelationship.Departments;
namespace IdentityRelationship;
public class IdentityRelationshipApplicationAutoMapperProfile : Profile
{
public IdentityRelationshipApplicationAutoMapperProfile()