저는 sensenet과 함께 작업 중이며 서버 측의 코드에서 노드를 만들 때 내 노드에 참조 필드를 추가해야하지만 어떻게해야할지 모르겠습니다. 그렇게. 노드를 만들 때 참조 추가 Sensetet
나는node["user"] = node1
같은 몇 가지 일을 시도했지만 작동하지 않습니다.
저는 sensenet과 함께 작업 중이며 서버 측의 코드에서 노드를 만들 때 내 노드에 참조 필드를 추가해야하지만 어떻게해야할지 모르겠습니다. 그렇게. 노드를 만들 때 참조 추가 Sensetet
나는node["user"] = node1
같은 몇 가지 일을 시도했지만 작동하지 않습니다.
당신은 내가 참조 필드를 추가 찾으의 문서 을 읽어야합니다, 당신은 당신이 참조 할 필요가 사용자 n은 당신의 분야에 대한 표현이
node.Addreferences("User", user1);
사용자 1 인 하나의 노드와 같은 어떤 것을 사용해야
Sensenet의 모든 내용 (데이터)은 binary tree으로 구성되며 Node은 해당 내용 유형 정의 (CTD)에 지정된 특정 Content 개체를 나타냅니다. 노드가 다른 노드를 참조 할 때 (즉, 트리의 다른 위치를 가리키는 경우) 두 가지 유형 중 하나 일 수 있습니다.
참조를 올바르게 지정했지만 오류가 발생하면 CTD의 유형 제약 조건을 위반하는 것일 수 있습니다. 아래 예를 참조하십시오.
CTD (부분) 특정 타입의 기준 노드 위에서 정의 된 분류 기준에 노드를 할당<ContentType name="Agent" parentType="GenericContent" handler="Code.ContentHandlers.Agent" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition">
<DisplayName>Agent</DisplayName>
<Icon>Content</Icon>
<Fields>
<Field name="Category" type="Reference">
<DisplayName>Agent Category</DisplayName>
<Description></Description>
<Configuration>
<AllowedTypes>
<Type>AgentCategory</Type>
</AllowedTypes>
<VisibleBrowse>Show</VisibleBrowse>
</Configuration>
</Field>
</Fields>
</ContentType>
예 C# 코드 용.
var path = "/Root/PathToAgentCategory";
var agentCat = Node.LoadNode(path) as AgentCategory;
myAgentNode.Category = agentCat; // Syntax if you have a ContentHandler
myAgentNode["Category"] = agentCat; // Syntax for the GenericContent ContentHandler