views:

20

answers:

0

I have this DTO:


public class ServerDTO
{
        [Key]
        [Editable(false)]
        public string Id { get; set; }

        public string Name { get; set; }
        public string OS { get; set; }
        public string ProcInfo { get; set; }

        [Include]
        [Association("Server_RamInfos", "Id", "HostId")]
        public List RamInfo { get; set; }

    public int RAMLength { get { return RamInfo.Count; } }
        [Include]
        [Association("Server_DriveInfos", "Id", "HostId")]
        public List DriveInfo { get; set; }
}

public class RamInfoDTO
{
        [Key]
        public string Name { get; set; }
        public double Amount { get; set; }

        public string HostId { get; set; }
}

In my DataForm's DataField template, I have added a Label but it fails in the Binding part since I get the FallbackValue "Failed!"

<toolkit:DataField Label="Total RAM">

  <TextBlock Text="{Binding Path=RamInfo.Amount, Mode=OneWay, FallbackValue=Failed!}" />

</toolkit:DataField>

And the Output window says this:

System.Windows.Data Error: BindingExpression path error: 'Amount' property not found on 'RamInfoDTO' 'System.ServiceModel.DomainServices.Client.EntityCollection`1[SP3DRepos.Web.DTOs.RamInfoDTO]' (HashCode=1301106). BindingExpression: Path='RamInfo.Amount' DataItem='ServerDTO : 956632f9-7af1-4bcf-bb01-d5179539660c' (HashCode=38280736); target element is 'System.Windows.Controls.TextBlock' (Name=''); target property is 'Text' (type 'System.String').

In the generated code, I can see this property for ServerDTO

/// /// Gets the collection of associated entities. /// [Association("Server_RamInfos", "Id", "HostId")] public EntityCollection RamInfo { get { if ((this._ramInfo == null)) { this._ramInfo = new EntityCollection(this, "RamInfo", this.FilterRamInfo); } return this._ramInfo; } }

Any thoughts are greatly appreciated.

thanks Sunit