簡體   English   中英

對 IntelliSense 隱藏屬性

[英]Hide property from IntelliSense

如何在 IntelliSense 中隱藏Base64EncodedCertificate屬性以使其無法查看?

我嘗試了以下屬性選項,但它們不起作用。

public class ThirdParty
{
    private string _Base64EncodedCertificate = null;

    public Guid ThirdPartyId { get; set; }
    // Notice: Allowed in source code use but not allowed in EFCore (EFCore doesn't support this).
    [NotMapped]
    public X509Certificate2 Certificate
    {
        get { return (_Base64EncodedCertificate == null ? null : new X509Certificate2(Convert.FromBase64String(_Base64EncodedCertificate))); }
        set { _Base64EncodedCertificate = (value == null ? null : Convert.ToBase64String(value.GetRawCertData())); }
    }
    // Notice: Not allowed in Source code but is used by EFCore (EFCore limitation workaround).
    [Browsable(false)]
    [Bindable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public string Base64EncodedCertificate
    {
        get { return _Base64EncodedCertificate; }
        private set { }
    }
    public string RawData { get; set; }
    public DateTime CreatedDate { get; set; }
}

您沒有將問題標記為 ef 相關,而是從源代碼中對該屬性的評論中 -

// Notice:Not allowed in Source code but is used by EFCore (EFCore limitation workaround).

如果我做對了,您僅將它用於查詢/插入/更新,如果是這種情況,您可以使用影子屬性沒有公共屬性的支持字段隱藏成員

也許您安裝了 ReSharper? 然后嘗試查看此選項:

ReSharper 智能感知

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM