Umbraco 6.1.5 および uSiteBuilder 3.0.0 での作業で問題が発生しました。ここContentHelper
で、DocumentType で定義されたすべてのフィールドを使用して強く型付けされた DocumentType をインスタンス化すると、オブジェクトにロードされますが、 のようなフィールドName
またはId
ロードChildren
されません (それらの ' re null、空、または 0)。
私が言えることContentHelper
は、インスタンス化を担当するメソッドが空のコンストラクターを呼び出しているためDynamicNode
です。足りないものはありますか?ドキュメント タイプでコンストラクタを定義する必要がありますか?
ここに私のDocumentTypeがあります:
namespace USiteBuilderTest.DocumentTypes
{
[DocumentType]
public class Home : DocumentTypeBase
{
[DocumentTypeProperty(Name = "Field 1")]
public string Field1 { set; get; }
[DocumentTypeProperty(Name = "Field 2")]
public string Field2 { set; get; }
[DocumentTypeProperty(Name = "Field 3")]
public string Field3 { set; get; }
}
}
参考までに、空のコンストラクターを呼び出しているコードの一部を次に示します。
Type typeDocType = DocumentTypeManager.GetDocumentTypeType(node.NodeTypeAlias);
if (typeDocType != null)
{
ConstructorInfo constructorInfo = typeDocType.GetConstructor(new[] { typeof(int) });
if (constructorInfo == null)
{
retVal = (DocumentTypeBase)Activator.CreateInstance(typeDocType);
}
else
{
retVal = (DocumentTypeBase)constructorInfo.Invoke(new object[] { node.Id });
}