Hi everyone I just started work as .netcore developer. They are using .net core with ef core. I saw some entitys has got constructor. I wonder whats that means. It's be like
using Project.Entities.CompanyEntity;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Project.Entities.Entity1
{
[Table("E_Entity1")]
public class EntityCategory : EntityBase
{
public EntityCategory()
{ //What is does makes. It fill theese data when i call "get" with DbContext
OtherCategoryBranches = new List<OtherCategoryBranch>();
AnotherCategories = new List<AnotherCategory>();
}
public Guid Id { get; set; }
public string Name { get; set; }
public string NormalizedName { get; set; }
public string Description { get; set; }
public Guid CompanyId { get; set; }
public virtual Company Company { get; set; }
public virtual List<OtherCategoryBranch> OtherCategoryBranches { get; set; }
public virtual List<AnotherCategory> AnotherCategories { get; set; }
}
}
//in other entity,"Other" ,Related to EntityCategory
namespace Project.Entities.OtherCategory
{
[Table("E_OtherCategoryBranches")]
public class OtherCategoryBranches : EntityBase
{
public Guid Id { get; set; }
public Guid EntityCategoryId { get; set; }
public virtual EntityCategory EntityCategory { get; set; }
}
}
2
In SSIS DatabaseDiagram the Entity1 table is
THe other related List's is for one to many right. And when call the get meton in DbContext it fill automaticly ?