简体   繁体   English

ComponentModel的Browsable false对特定模型不起作用

[英]ComponentModel's Browsable false doesn't work for specific model

I have DataGridView and I display different tables. 我有DataGridView并显示不同的表。 Everything worked fine but I had to update my Entity Framework model and it reset all my model classes. 一切正常,但我必须更新实体框架模型,并且重置所有模型类。 Now only one class still displays ID Column and other ones hide it . 现在, 只有一个类仍显示“ ID列”,其他类将其隐藏 I can't see any difference in this class than other ones. 我看不出这堂课和其他课有什么区别。

namespace KasaMP.OsnovniPodaci
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;

public partial class Artikl
{
    [Browsable(false)]
    public int IDArtikli { get; set; }
    public string Barkod { get; set; }
    public Nullable<int> Sifra { get; set; }
    public string Naziv { get; set; }
    public string JedinicaMjere { get; set; }
    public decimal Tarifa { get; set; }
    public Nullable<decimal> ProdajnaCijena { get; set; }
    [Browsable(false)]
    public Nullable<bool> Flag { get; set; }
    public Nullable<decimal> Kalo { get; set; }
    public Nullable<decimal> NabavnaCijena { get; set; }
    public Nullable<decimal> VeleprodajnaCijena { get; set; }
    public Nullable<decimal> Zalihe { get; set; }
}
}

在此处输入图片说明

Other model classes perfectly hide it, what's going on? 其他模型类完全隐藏了它,这是怎么回事?

namespace KasaMP.OsnovniPodaci
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;

    public partial class Porez
    {
        [Browsable(false)]
        public int IDPorez { get; set; }
        public decimal Tarifa { get; set; }
        public decimal Porez1 { get; set; }
        public decimal PorezUsluge { get; set; }
        public decimal PorezPotrosnje { get; set; }
    }
}

在此处输入图片说明

I use the same Form and the same DatagridView control to display this - why is Visual Studio discriminating my Artikl class :C 我使用相同的Form和相同的DatagridView控件来显示此内容-为什么Visual Studio区分我的Artikl类:C

OK, turn out it's probably some Visual Studio/cache bug, I'm not sure... 好吧,原来这可能是一些Visual Studio /缓存错误,我不确定...

but it suddenly - magically - works now... 但是它突然-神奇地-现在可以工作了...

Unfortunatelly I can't write a better answer 不幸的是我无法写出更好的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM