홈>
최근 버전 4.3.4.197에서 실행되는 Glass Mapper를 업데이트해야하는 업그레이드의 일부로 Sitecore 8.2, Rev3에서 실행되도록 프로젝트를 최근에 업그레이드했습니다.
항목을 만들려고 할 때 오류가 발생했습니다 :
var service = new SitecoreService(_database);
service.Create(parent, redHotDeal);
우리가 얻는 예외는 : 부모 항목 유형 Sitecore.Data.Items.Item에 대한 구성을 찾지 못했습니다
스택 추적 :
c : \ TeamCity \ buildAgent \ work \ 8567e2ba106d3992 \ Source \ Glass.Mapper.Sc에서Glass.Mapper.Sc.SitecoreService.Create [T, TK] (TK 상위, T newItem, 부울 업데이트 통계, 부울 자동)에서
\ SitecoreService.cs : 라인 200 TTC.IV.Infrastructure.Import.RedHotDeals.RedHotDealsImporter.ImportRedHotDeals (IEnumerable`1 redhotdeals, 항목 상위)의 G : \ TFSProjects \ IV \ Source \ TTC.IV.Infrastructure \ Import \ RedHotDeals \ RedHotDealsImporter.cs : line 104
이 문제가 발생했거나 원인을 알고있는 사람이 있습니까?
설정에 대한 좀 더 자세한 정보 : 상위 항목은 Sitecore.Data.Items.Item 유형입니다. redHotDeal 항목은 DealCollectionItem 유형입니다
DealCollectionItem 모델은 다음과 같습니다 :
시스템을 사용하는 것; Glass.Mapper.Sc.Configuration.Attributes 사용;
namespace TTC.IV.Model.Templates.Items
{
[SitecoreType(TemplateId = TemplateStringId)]
public class DealCollectionItem : Item
{
public new static Guid TemplateId = new Guid(TemplateStringId);
private const string TemplateStringId = "{998CA212-92D5-4566-B877-44D1F378EFD6}";
/// <summary>
/// Gets or sets the mv code.
/// </summary>
/// <value>
/// The mv code.
/// </value>
[SitecoreField]
public virtual string MvCode { get; set; }
/// <summary>
/// Gets or sets the departure code.
/// </summary>
/// <value>
/// The departure code.
/// </value>
[SitecoreField]
public virtual string DepartureCode { get; set; }
/// <summary>
/// Gets or sets the discount.
/// </summary>
/// <value>
/// The discount.
/// </value>
[SitecoreField]
public virtual double Discount { get; set; }
/// <summary>
/// Gets or sets the promo code.
/// </summary>
/// <value>
/// The promo code.
/// </value>
[SitecoreField]
public virtual string PromoCode { get; set; }
/// <summary>
/// Gets or sets the price.
/// </summary>
/// <value>
/// The price.
/// </value>
[SitecoreField]
public virtual double Price { get; set; }
/// <summary>
/// Gets or sets the promo amount.
/// </summary>
/// <value>
/// The promo amount.
/// </value>
[SitecoreField]
public virtual double PromoAmount { get; set; }
/// <summary>
/// Gets or sets the table amount.
/// </summary>
/// <value>
/// The table amount.
/// </value>
[SitecoreField]
public virtual int TableAmount { get; set; }
/// <summary>
/// Gets or sets the import region.
/// </summary>
/// <value>
/// The import region.
/// </value>
public string ImportRegion { get; set; }
}
}
-
답변 # 1
관련 질문
- Sitecore의 편안한 API 인증이 토큰을 반환하지 않음
- visual studio - Sitecore 팝업이있는 TDS Hedgehog 동기화 프로젝트에 빈 프레임 만 표시
- sitecore8 - 구성 요소 제거를 방지하는 Sitecore
- compatibility - Sitecore IsPageEditor 및 IsExperienceEditor
- nuget - 'GlassMapper'패키지의 '421188'버전을 찾을 수 없습니다
- sitecore8 - XML 및 ShowModalDialog를 사용하여 사이트 코어 대화 상자를 만드는 방법
- caching - Sitecore 사용자 정의 캐시는 모든 CD 서버에서 공유되지 않습니다
- orm - GlassMapper 기본 컨텍스트 V5 가져 오기
- sitecore8 - 프로그래밍 방식으로 Sitecore에서 항목 버전 비교
이제 해결되었습니다. https://github.com/mikeedwards83/Glass.Mapper/issues/305에 따라 조언을 따르고 항목을 'Item'이라고하고 자동 매핑을 통해 속성으로 매핑했습니다.