나는 첫 번째 사용자 지정 Umbraco 5.1 솔루션을 만들었습니다. 이 시점에서 콘텐츠 항목 ("homepage")은 사용자 지정 템플릿이고 사용자 지정 부분 매크로이 있습니다. 이제 Umbraco
도우미를 사용하여 엔티티를로드하려면 어떻게해야합니까?Umbraco 5 Very Basic - 매크로에서 엔티티를로드하는 방법 (또는 실제로 HiveId를 사용하는 방법)?
Parameter 'other' must be of type Guid to convert to a Guid CLR type, but it is 'Uri', with value: xxx
매크로 부분 :
@inherits PartialViewMacroPage @using Umbraco.Cms.Web @using Umbraco.Cms.Web.Macros @using Umbraco.Framework @{ //All these fail with the same error message... //Based on name: var p = Umbraco.GetContentById( new HiveId( new Uri("content://Homepage"))); //Based on path var p = Umbraco.GetContentById( new HiveId( new Uri("content://p__nhibernate/v__guid/5a4abe489a2e47858bd2a0580180b683"))); //With custom Hive provider (I've added this using a custom tree/section and products show up, so the hive provider works) var p = Umbraco.GetContentById( new HiveId( new Uri("custom://products/1"))); }
흠, 좋아, 첫 번째 작품,하지만 내가 'HiveId' 과부하를 사용하면 ... 첫 번째는 내 사용자 정의'HiveProvider'를 위해 작동하지 않습니다. 그것은 단지 "데이터 URI"권한을 가져야합니까? – Ropstah
@Ropstah 나는 Umbraco를 열고 두 가지를 모두 테스트했으며 둘 다 나를 위해 일했습니다. string/hiveid 대신에 Data Uri를 사용해야하는 이유가 있습니까? – Marko
둘 다 실제로 작동하기 때문에 뭔가를 놓쳤음에 틀림 없습니다. 주제가 너무 많아지기를 원하지 않지만 실제로 원하는 것은 하이퍼를 사용하여 사용자 지정 하이브 공급자를 쿼리하는 것입니다. "Uri"를 내 엔터티에 가져 오는 방법에 대해서는 모르겠다. (백 오피스에 내 사용자 지정 하이브 공급자 데이터를 표시하는 사용자 지정 트리가있다.) – Ropstah