Skip to content

使用 SqlSugar ORM 导航属性问题 #5366

Answered by ArgoZhang
SmartCode-X asked this question in Q&A
Discussion options

You must be logged in to vote

@SmartCode-X 绑定表格的数据模型为 BarCode

[SugarTable("STK_BarCode", TableDescription = "条码主档")]
[SugarIndex("IDX_Number", nameof(Number), OrderByType.Asc)]
[Tenant(SqlSugarConst.DB_MOM)]
public class BarCode : BaseEntity
{
    /// <summary>
    /// 物料Id
    ///</summary>
    [SugarColumn(ColumnDescription = "物料Id")]
    [Required]
    [AutoGenerateColumn(Filterable = true, Sortable = true)]
    public virtual long MaterialId { get; set; }

    /// <summary>
    /// 物料导航属性
    ///</summary>
    [Navigate(NavigateType.OneToOne, nameof(MaterialId))]
    public virtual Material? Material { get; set; }

    /// <summary>
    /// 数量
    ///</summary>
    [SugarColumn(ColumnDescription = "数量", Length = 1…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@SmartCode-X
Comment options

@densen2014
Comment options

Answer selected by SmartCode-X
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
enhancement New feature or request
4 participants
Converted from issue

This discussion was converted from issue #5363 on February 15, 2025 04:43.