Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sitecoreservice.getitem Not returning children items #438

Open
vijayakarunakar opened this issue Jun 3, 2021 · 8 comments
Open

sitecoreservice.getitem Not returning children items #438

vijayakarunakar opened this issue Jun 3, 2021 · 8 comments

Comments

@vijayakarunakar
Copy link

I'm currently upgrading to GlassMapper V5, sitecoreservice.getitem Not returning children items for Glass.Mapper.Sc.101 & Sitecore 10.0.1

var TemplateID = Guid.Parse("{51A26CD4-FCB5-4A3C-8720-2D60F625A678}");
var _Options = new GetItemByIdOptions(TemplateID)
{
InferType = true,
Lazy = Glass.Mapper.LazyLoading.Enabled
};
var target = context.SitecoreService.GetItem(_Options);

@mikeedwards83
Copy link
Owner

Hi

Do you have the model?

The mostly likely cause is that the property is miss the virtual keyword, e.g:

public virtual IEnumerable<Model> Children {get;set;}

@vijayakarunakar
Copy link
Author

Yes I'm using virtual keyword, but getting this error: "((Castle.Proxies.IGlassModelProxy)_target).Chlidren error CS0234: The type or namespace name 'IGlassModelProxy' does not exist in the namespace 'Castle.Proxies' (are you missing an assembly reference?)
".
Please find below model:
using System;
using System.Collections.Generic;
using Glass.Mapper.Sc.Configuration;
using Glass.Mapper.Sc.Configuration.Attributes;
using Glass.Mapper.Sc.DataMappers;
using Sitecore.Data.Items;

namespace GlassMapper_POC
{
[SitecoreType(TemplateId = "{19CDADF8-D474-42C9-8C8D-522A7FF93663}", AutoMap=true)]
public class IGlassModel

{
    Guid Id { get; set; }

    string Path { get; set; }

    //[SitecoreItem]
    //string Name { get; set; }

    [SitecoreChildren]
   public virtual IEnumerable<Country> Chlidren { get; set; }

}       

[SitecoreType(TemplateId = "{780F8593-3AFA-4DF0-98EE-16FFDD18F88F}", AutoMap = true)]
public class Country
{
    Guid Id { get; set; }

    string Path { get; set; }

    [SitecoreItem]
    string CountryName { get; set; }

    [SitecoreItem]
    string CountryCode { get; set; }
}

}

@mikeedwards83
Copy link
Owner

Do you ahve the full stacktrace?

@vijayakarunakar
Copy link
Author

image
PFA screen shot of stacktrace

@mikeedwards83
Copy link
Owner

I need the full stack

@vijayakarunakar
Copy link
Author

" at GlassMapper_POC.ControllerGlass.test()\r\n at ASP._Page_GlassPOC_GetItems_cshtml.Execute()\r\n at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()\r\n at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()\r\n at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)\r\n at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)\r\n at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)\r\n at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)\r\n at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args)\r\n at (Object , Object )\r\n at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)\r\n at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)\r\n at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)\r\n at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)\r\n at Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs args)\r\n at (Object , Object )\r\n at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)\r\n at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)\r\n at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)\r\n at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)\r\n at Sitecore.Mvc.Helpers.SitecoreHelper.RenderPlaceholderCore(String placeholderName, TextWriter writer)\r\n at Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName)\r\n at ASP._Page_GlassPOC_Layout_cshtml.Execute()\r\n at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()\r\n at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()\r\n at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)\r\n at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)\r\n at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)\r\n at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)\r\n at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args)\r\n at (Object , Object )\r\n at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)\r\n at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)\r\n at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)\r\n at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)\r\n at Sitecore.Mvc.Presentation.RenderingView.Render(ViewContext viewContext, TextWriter writer)\r\n at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)\r\n at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)\r\n at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)\r\n at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)\r\n at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult)\r\n at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.b__5(IAsyncResult asyncResult)\r\n at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)\r\n at System.Web.Mvc.Controller.<>c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState)\r\n at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)\r\n at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)\r\n at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)\r\n at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)\r\n at System.Web.Mvc.MvcHandler.<>c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState)\r\n at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)\r\n at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)\r\n at Sitecore.Mvc.Routing.RouteHttpHandler.EndProcessRequest(IAsyncResult result)\r\n at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)\r\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)\r\n at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)\r\n at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)\r\n at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)\r\n at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)\r\n at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)\r\n at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)\r\n at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)\r\n at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)\r\n at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)\r\n"

@vijayakarunakar
Copy link
Author

Please let me know if this help.

@KrisBethea
Copy link

I'm having this same issue. Has this been resolved? (Or am I doing something incorrectly?)
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants