Create your first Team
This page will explains how to create a team inside your project.
Prerequisites
Make sure to have your project created by following the steps on this page.
Create the Model
- In '...\MyFirstProject\DotNet\MyCompany.MyFirstProject.Domain' create 'Company' folder, then create a folder 'Entities' into it. Use the parent's domain existing module folder if exists.
- Create empty class 'Company.cs' and add following:
// <copyright file="Company.cs" company="MyCompany">
// Copyright (c) MyCompany. All rights reserved.
// </copyright>
namespace MyCompany.MyFirstProject.Domain.Company.Entities
{
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using MyCompany.MyFirstProject.Domain.User.Entities;
/// <summary>
/// The company entity.
/// </summary>
public class Company : Team
{
/// <summary>
/// Gets or sets the Id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the company name.
/// </summary>
public string CompanyName { get; set; }
/// <summary>
/// Add row version timestamp in table Company.
/// </summary>
[Timestamp]
[Column("RowVersion")]
public byte[] RowVersionCompany { get; set; }
}
}
- In case of children team, ensure to have logical links between the parent and child entities.
Make sure to inherit from Team and expose a byte[] row version property mapped to column RowVersion.
Complete with all necessary properties.
You must expose the Id property even if it's hide the inherited property of Team
Complete DataContext
- Go in '...\MyFirstProject\DotNet\MyCompany.MyFirstProject.Infrastructure.Data' folder.
- Open DataContext.cs and add your new
DbSet<Company>:
public class DataContext : BiaDataContext
{
// Existing DbSet<T>
/// <summary>
/// Gets or sets the Company DBSet.
/// </summary>
public DbSet<Company> Companies { get; set; }
}
- In folder ModelBuilders, create class CompanyModelBuilder.cs or use parent's model builder, and add :
namespace MyCompany.MyFirstProject.Infrastructure.Data.ModelBuilders
{
using Microsoft.EntityFrameworkCore;
using MyCompany.MyFirstProject.Domain.Company.Entities;
/// <summary>
/// Class used to update the model builder for Company domain.
/// </summary>
public static class CompanyModelBuilder
{
/// <summary>
/// Create the model for projects.
/// </summary>
/// <param name="modelBuilder">The model builder.</param>
public static void CreateModel(ModelBuilder modelBuilder)
{
CreateCompanyModel(modelBuilder);
}
/// <summary>
/// Create the model for companiess.
/// </summary>
/// <param name="modelBuilder">The model builder.</param>
private static void CreateCompanyModel(ModelBuilder modelBuilder)
{
// Use ToTable() to create the inherited relation with Team in database
modelBuilder.Entity<Company>().ToTable("Companies");
}
}
}
- If added to existing parent's model builder, add only the method
CreateCompanyModeland make a call inside theCreateModelmethod. - Back to DataContext.cs, ensure to have a call to your model builder's method
CreateModel:
public class DataContext : BiaDataContext
{
/// <inheritdoc cref="DbContext.OnModelCreating"/>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// Existing model builders
CompanyModelBuilder.CreateModel(modelBuilder);
this.OnEndModelCreating(modelBuilder);
}
}
- In case of children team, ensure to specify logical links between the parent and child entities.
Generate DTO
Using BIAToolKit
- Launch the BIAToolKit, go to the tab "Modify existing project".
- Set your parent project path, then select your project folder.
- Go to "DTO Generator" tab.
- Fill the form as following :

- Then, click on Generate button !
Children Team case
Complete the generated DTO :
- ensure to set the first
AncestorTeamparent's type intoBiaDtoClassclass annotation - set
IsParentto true inBiaDtoFieldfield annotation for parent's id property
/// <summary>
/// The DTO used to represent a company child.
/// </summary>
[BiaDtoClass(AncestorTeam = "Company")]
public class CompanyChildDto : TeamDto
{
[...]
/// <summary>
/// Gets or sets the parent's company id.
/// </summary>
[BiaDtoField(IsParent = true, Required = true)]
public int CompanyId { get; set; }
}
Generate CRUD
Using BIAToolKit
- Launch the BIAToolKit, go to the tab "Modify existing project".
- Set your parent project path, then select your project folder.
- Go to "CRUD Generator" tab.
- Fill the form as following :

- If your Team inherits from parent, click on the "Has Parent" checkbox and complete the parent's name singular and plural
- Then, click on Generate button !
Customize generated files
After the files generation, some customization is needed.
Back
Open your DotNet project solution in '...\MyFirstProject\DotNet' and complete the following files.
RoleId.cs
- Go in 'MyCompany.MyFirstProject.Crosscutting.Common\Enum' folder and open RoleId.cs file.
- Adapt the enum value of the generated value
CompanyAdmin. - In case of children team, review the
TeamLeadercreated value. Delete new generated value if already exists and in use by other teams.
TeamTypeId.cs
- Stay in 'MyCompany.MyFirstProject.Crosscutting.Common\Enum' folder and open TeamTypeId.cs file.
- Adapt the enum value of the generated value
Company.
Front
Open your Angular project folder '...\MyFirstProject\Angular' and complete the following files.
constants.ts
- Go in 'src\app\shared' folder and open constants.ts file.
- Go in
TeamTypeIdenum declaration. - Adapt the enum value of the generated value
Company.
navigation.ts
- Stay in 'src\app\shared' folder and open navigation.ts file.
- Adapt the path of the generated navigation for companies :
{
labelKey: 'app.companies',
permissions: [Permission.Company_List_Access],
/// TODO after creation of CRUD Team Company : adapt the path
path: ['/companies'],
},
- In case of children team, you can move if needed the generated content into the children's array of parent
BiaNavigation:
{
labelKey: 'app.companies',
permissions: [Permission.Company_List_Access],
path: ['/companies'],
children: [
/// BIAToolKit - Begin Partial Navigation CompanyMaintenance
{
labelKey: 'app.company-maintenances',
permissions: [Permission.CompanyMaintenance_List_Access],
/// TODO after creation of CRUD Team Company : adapt the path
path: ['/company-maintenances'],
},
/// BIAToolKit - End Partial Navigation CompanyMaintenance
],
},
model.ts
- Go in 'src\app\features\companies\model' or the children parent's path of the generated feature
companiesand open the company.ts file. - Adapt the field configuration if needed.
- Remove all unused imports from the generated file.
Additionnal configuration
The additionnal configuration for the teams is based on the TeamConfig.cs from the domain layer in the back-end.
Role mode
You can set the role mode for your team.
new BiaTeamConfig<Team>()
{
// [...]
RoleMode = BIA.Net.Core.Common.Enum.RoleMode.AllRoles,
},
AllRoles: all roles are selectedSingleRole: you can select only one roleMultiRoles: you can select multiple roles
Automatic team selection mode
You can choose the selection mode if not default team has been set by the user.
new BiaTeamConfig<Team>()
{
// [...]
TeamAutomaticSelectionMode = BIA.Net.Core.Common.Enum.TeamSelectionMode.None,
},
None: leave empty team selectionFirst: the first team available (ordered by ID)
Clear and choose no team in selector
You can set if the users can clear and select empty team in the team selector.
new BiaTeamConfig<Team>()
{
// [...]
TeamSelectionCanBeEmpty = true,
},
Display mode
You can configure how to display your Team into your front-end.
new BiaTeamConfig<Team>()
{
// [...]
// Display the Team selector into the header of your application
DisplayInHeader = true,
// Always display the Team selector or only if there is more than one team choice
DisplayAlways = true,
// Display the label (Team Title) of the Team selector
DisplayLabel = true,
},
Complete traductions
- Go in '...\MyFirstProject\Angular\src\assets\i18n\app'
- Complete each available language traduction JSON file with the correct values :
"app": {
//...
"companies": "companies"
},
"company": {
"add": "Add company",
"edit": "Edit company",
"listOf": "List of companies",
"headerLabel": "Company",
"admins": "Company administrators",
"filterMember": "Member user",
"goto": "View Company",
"companyName": "Company name"
},
Update the database
- Open the solution '...\MyFirstProject\DotNet\MyFirstProject.sln'.
- Open a new Package Manager Console.
- Set default project to MyCompany.MyFirstProject.Infrastructure.Data.
- Run command
add-migration -context "DataContext" AddTeamCompany(replace Company by your new team). - Verify the generated migration.
- Run command
update-database -context "DataContext" - Verify your database.
Testing your Team
- Run the DotNet solution.
- Launch
npm startin Angular folder. - Go to http://localhost:4200/
- Navigate to the company team list.
