开发者

Dynamic Data foreign key table display name

I have these two tables in my diagram:

the 1st:

PAR_TipiDocumento with

idTipoDocumento PK

idClasseDocumento

[...]

the 2nd:

PAR_ClassiDocumento with

idClasseDocumento PK

[...]

and a foreing key FK_PAR_TipiDocumento_PAR_ClassiDocumento from PAR_TipiDocumento.idClasseDocumentoto PAR_ClassiDocumento.idClasseDocumento.

This is my .cs code for the metadata:

[MetadataType(typeof(PAR_TipiDocumento_Metadata))]
[DisplayName("Tipi Documento")]
public partial class PAR_TipiDocumento
{
    [DisplayName("Tipi Documento")]
    [TableName("Tipi Documento")]        
    [ScaffoldTable(true)]
    public class PAR_TipiDocumento_Metadata
    {
        [Display(Name = "Classe Documento", Order = 1开发者_JAVA技巧)]
        public object PAR_ClassiDocumento { get; set; }

        /* other fields*/
    }
}


[MetadataType(typeof(PAR_ClassiDocumento_Metadata))]
[DisplayName("Classi Documento")]
public partial class PAR_ClassiDocumento
{
    public override string ToString()
    {
        return Codice.ToString() + " - " + Descrizione.ToString();
    }

    [TableName("Classi Documento")]
    [ScaffoldTable(true)]
    public class PAR_ClassiDocumento_Metadata
    {
        /* other fields*/
    }
}

The problem is that in the Dynamic Data generated pages I correctly see all the display names "Tipi Documento" except for the header row of the PAR_ClassiDocumento table where I have "PAR_TipiDocumentos" (the plural generated by LINQ to SQL). The values under this column are correctly rendered as links to the PAR_TipiDocumento table with the right display name ("View Tipi Documento").

How can I change the Display Name of that "PAR_TipiDocumentos"?

Thanks in advance.


Ok I found how to obtain this.

I just needed to add this attribute:

    [TableName("Classi Documento")]
    [ScaffoldTable(true)]
    public class PAR_ClassiDocumento_Metadata
    {
        /* other fields */

        [Display(Name = "Tipi Documento collegati")]
        public object PAR_TipiDocumentos { get; set; }

    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜