[英]86 / 5.000 Çeviri sonuçları I created my model, but I don't know exactly how to create the Dto. How can I do it?
My intern and I created my model in relation to other tables.我和我的实习生创建了与其他表格相关的模型。 Now I need to create the Dto.现在我需要创建 Dto。 I'm not completely sure and I'm a little confused when creating relationship structures.我不完全确定,在创建关系结构时我有点困惑。 I need to create the Dto of my model.我需要创建模型的 Dto。 How can I create it without error?我怎样才能没有错误地创建它? Can you help me?你能帮助我吗?
My Model: Activity.cs我的模型:Activity.cs
[Table("Activity")]
public class Activity : FullAuditedEntity<int>
{
public int ScenarioId { get; set; }
public int BrandId { get; set; }
public int CategoryId { get; set; }
public int ProductId { get; set; }
public int ProductCodeId { get; set; }
public decimal DiscountedPrice { get; set; }
public decimal Discount { get; set; }
public decimal PromoMargin { get; set; }
[Description("Covid Connected Shutdown Status")]
public bool ShutdownStatus { get; set; }
[ForeignKey("BrandId")]
public virtual Brand Brand { get; set; }
[ForeignKey("CategoryId")]
public virtual Category Category { get; set; }
[ForeignKey("ProductId")]
public virtual Product Product { get; set; }
[ForeignKey("ProductCodeId")]
public virtual ProductCode ProductCode { get; set; }
[ForeignKey("ScenarioId")]
public virtual Scenario Scenario { get; set; }
I need to create ActivityDto.cs我需要创建 ActivityDto.cs
[AutoMapFrom(typeof(Activity))]
public class ActivityDto : FullAuditedEntity<int>
{
[Required]
public decimal ActivityName { get; set; }
[Required]
public decimal DiscountedPrice { get; set; }
[Required]
public decimal Discount { get; set; }
[Required]
public decimal PromoMargin { get; set; }
[Required]
[Description("Covid Connected Shutdown Status")]
public bool ShutdownStatus { get; set; }
}
How can i create other relations dto too.我如何也可以创建其他关系 dto。 Do I need to keep their Id in the form of a new list?我是否需要以新列表的形式保留他们的 ID?
Your Dto Class is inherited by FullAuditedEntity<int>
.您的 Dto 类由FullAuditedEntity<int>
继承。 It must be inherited like this FullAuditedEntityDto<int>
它必须像这样继承FullAuditedEntityDto<int>
For the other relations, it is enough to describe relational entities id like this:对于其他关系,像这样描述关系实体 id 就足够了:
public id BrandId { get; set; }
public id CategoryId { get; set; }
.
.
.
.
Good luck!祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.