开发者

How to display additional (calculated) entity field into dynamic data web site?

I'm displaying list of products using dy开发者_高级运维namic data web site. That is easy.

Is there any way to display amount of 'orders' related to that product? How to do that?

Thanks.

P.S. Probably, I should write a stored procedure for that and work with SP as with table?


public partial class Product
{
    [ScaffoldColumn(true)]
    public int orderNum
    {
        get
        {   
            return //Insert code here to get number of ordrs for product
        }
    }
    }


public class ProductMetadata
{
    [ReadOnly(true)]
    [Display(Name = "[Number of Orders]", AutoGenerateField = true, AutoGenerateFilter = false)]
    public object orderNum { get; set; } 

        .
        .
        .

    }


It is possible to extend the class generated for the table; extending the class you can define custom field and in such a field you can calculate (by code using, for example, Linq) the desired total using as parameter the other field of the record.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜