Многоязычное картографирование сущностей - PullRequest
0 голосов
/ 22 ноября 2018
public class Product : Entity, IMultiLingualEntity
{
    public virtual decimal Price { get; set; }
    public virtual int Stock { get; set; }
    public virtual ICollection<ProductTranslation> Translations { get; set; }
}


public class ProductTranslation : Entity, IEntityTranslation
{
    public virtual string Name { get; set; }
    public virtual Product Core { get; set; }
    public virtual int CoreId { get; set; }
    public virtual string Language { get; set; }
}

для Dto

public class ProductCreateDto
{
    public decimal Price { get; set; }
    public int Stock { get; set; }
    public string Name { get; set; }
}

как я могу сопоставить ProductCreateDto => Product, чтобы для новой записи была вставлена ​​новая запись для ProductTranslation с текущим языком CultureInfo.CurrentUICulture.Name и для ProductTranslation.Name =ProductCreateDto.Name

...