2

I've create new web site based on 'Dynamic Data Site' template. 3 tables were added into it: Product, ProductSKU, SkuPrice. There are relationships between tables:

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

I don't want 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 '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 doesn't work: column is still displayed. The problem seems like that '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 also: table still exists on the 1st page...

Why? How to fix that?

Thanks a lot!

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
Budda
  • 18,015
  • 33
  • 124
  • 206

1 Answers1

2

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

P.S. Actually, my linked answer was deleted by moderator (don't know why), but problem was in in VS: it didn't consider entity class as partial... and as a result didn't apply metadataclass to the entity class.

Community
  • 1
  • 1
Budda
  • 18,015
  • 33
  • 124
  • 206