mikependon / RepoDB

A hybrid ORM library for .NET.
Apache License 2.0
1.7k stars 125 forks source link

Question: How to hide properties #1155

Closed marciogoularte closed 1 year ago

marciogoularte commented 1 year ago

How to hide properties? I have this model with IEnumerable properties is be relations.

[Table("Roles")]
public class Role
{       
    [Column] public long Id { get; set; } 
    [Column] public Guid Key { get; set; } 
    [Column] public string Name { get; set; } 
    [Column] public string ConcurrencyStamp { get; set; }
    [Column] public string Description { get; set; }
    [Column] public string NormalizedName { get; set; } 

    /// <summary>
    /// FK_RoleClaims_Roles_RoleId_BackReference (dbo.RoleClaims)
    /// </summary>
    [NotMapped]
    public IEnumerable<RoleClaim> RoleClaims { get; set; }

    /// <summary>
    /// FK_UserRoles_Roles_RoleId_BackReference (dbo.UserRoles)
    /// </summary>
    [NotMapped]
    public IEnumerable<UserRole> UserRoles { get; set; }

}

But when save, delete, update this error happens.

Microsoft.Data.SqlClient.SqlException: Invalid column name 'RoleClaims'. Invalid column name 'UserRoles'.

I tried to use attribute Not Mapped, but not works. I use version 1.13.1 and this version not exitis more attribute Ignore.

Is possible to use Data annotations attibutes? or another way?