2010-07-01 3 views
0

안녕하세요, 저는 ria 서비스를 통해 수업을 진행합니다.ria 서비스를 통해 맞춤 DTO 보내기

[DataContract] 
public partial class AttributeNode 
{ 
    [DataMember] 
    [Key] 
    public int Uid { get; set; } 

    public AttributeNode() 
    { 
     this.Children = new List<String>(); 
    } 

    private String text; 

    [DataMember] 
    public String Text 
    { 
     get 
     { 
      return text; 
     } 
     set 
     { 
      text = value; 
      this.Uid = text.GetHashCode(); 
     } 
    } 

    [DataMember] 
    [Include] 
    [Association("AttributeNode_AttributeNode", "Uid", "Uid")] 
    public List<AttributeNode> Children { get; set; } 

    public void AddChild(AttributeNode child) 
    { 
     this.Children.Add(child); 
    } 
} 

문제와 같은 클래스 보면 내가 클라이언트에 객체를 받아 봐 때 확인되지 점이다. 그것은 항상 어린이가 자신을 포함하기 때문에. 문제가 같은 유형의 목록에 있습니다. 도움?

Tnx !!

답변

2

나는 이것이 일종의 부모 - 자식 트리 구조라고 생각해.

연관 태그는 "이 키"와 "다른 키"를 말하는 데 사용됩니다.

AttributeNode 클래스에는 부모 속성을 알려주는 Id 속성이 필요합니다.

당신은해야 할 것

[Key] 
public int Uid { get; set; } 
public int ParentUid { get; set; } 


[Include] 
[Association("AttributeNode_AttributeNode", "Uid", "ParentUid")] 
public List<AttributeNode> Children { get; set; } 
관련 문제