动态数据站点:无法隐藏表格

发布于 2024-11-07 19:03:06 字数 1550 浏览 1 评论 0原文

我基于“动态数据网站”模板创建了一个新网站。添加了三个表:Product、ProductSKU 和 SkuPrice。表之间存在关系:

Product.ProdId = ProductSku.ProdId
ProductSku.SkuId = SkuPrice.SkuId

我不希望用户看到“Product”表,因此我隐藏了该表:

namespace CompanyDbAdmin
{
    [MetadataType(typeof(ProductMetadata))]
    public partial class Product
    {
    }

    [ScaffoldTable(false)]
    public class ProductMetadata
    {
    }
}

当我尝试隐藏“ProductSKU”表中的某些列时:

namespace CompanyDbAdmin
{
    [MetadataType(typeof(ProductSKUMetadata))]
    public partial class ProductSKU
    {
    }

    public class ProductSKUMetadata
    {
        [ScaffoldColumn(false)]
        public object MyCollumnName { get; set; }
    }
}

我发现并没有work:该列仍然显示。问题似乎是“ProductSKU”类与现有表不“匹配”...

这是该表的自动生成的代码:

namespace CompanyDbAdmin
{

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="SotiModel", Name="ProductSKU")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class ProductSKU : EntityObject
    {
        ....
    }
}

尝试隐藏此表

namespace CompanyDbAdmin
{
    [MetadataType(typeof(ProductSKUMetadata))]
    public partial class ProductSKU
    {
    }

    [ScaffoldTable(false)]
    public class ProductSKUMetadata
    {
        [ScaffoldColumn(false)]
        public object MyCollumnName { get; set; }
    }
}

也不起作用:该表仍然存在于第一页上...

为什么?我该如何解决这个问题?

I've created a new web site based on the 'Dynamic Data Site' template. Three tables were added into it: Product, ProductSKU, and SkuPrice. There are relationships between tables:

Product.ProdId = ProductSku.ProdId
ProductSku.SkuId = SkuPrice.SkuId

I don't want the user to see 'Product' table, so I've hidden that table:

namespace CompanyDbAdmin
{
    [MetadataType(typeof(ProductMetadata))]
    public partial class Product
    {
    }

    [ScaffoldTable(false)]
    public class ProductMetadata
    {
    }
}

When I tried to hide some columns in the 'ProductSKU' table:

namespace CompanyDbAdmin
{
    [MetadataType(typeof(ProductSKUMetadata))]
    public partial class ProductSKU
    {
    }

    public class ProductSKUMetadata
    {
        [ScaffoldColumn(false)]
        public object MyCollumnName { get; set; }
    }
}

I've discovered that didn't work: the column is still displayed. The problem seems like the 'ProductSKU' class is not 'matched' to existing table...

Here is auto-generated code for that table:

namespace CompanyDbAdmin
{

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="SotiModel", Name="ProductSKU")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class ProductSKU : EntityObject
    {
        ....
    }
}

Attempt to hide this table with

namespace CompanyDbAdmin
{
    [MetadataType(typeof(ProductSKUMetadata))]
    public partial class ProductSKU
    {
    }

    [ScaffoldTable(false)]
    public class ProductSKUMetadata
    {
        [ScaffoldColumn(false)]
        public object MyCollumnName { get; set; }
    }
}

Doesn't work either: The table still exists on the first page...

Why? How can I fix that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只涨不跌 2024-11-14 19:03:06

该问题的解决方案: 部分类不与自动生成的类部分匹配解决了当前的问题

问题出在 Visual Studio 中:它没有将实体类视为分部类...结果,它没有将元数据类应用于实体类。

The solution to that question: Partial class doesn't match to auto-generated class part resolved the current one either

The problem was in in Visual Studio: it didn't consider the entity class as a partial class... And as a result, it didn't apply metadataclass to the entity class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文