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