/// <summary> /// Maps the Sitecore.Context.Item to a model /// </summary> /// <typeparam name="T">The type to return</typeparam> /// <param name="options">Options for how the model will be retrieved</param> /// <returns></returns> public virtual T GetContextItem <T>(GetKnownOptions options) where T : class { Assert.IsNotNull(options, "options must no be null"); options.Item = ContextItem; return(SitecoreService.GetItem <T>(options)); }
/// <summary> /// Maps the Sitecore.Context.Item to a model /// </summary> /// <typeparam name="T">The type to return</typeparam> /// <param name="options">Options for how the model will be retrieved</param> /// <returns></returns> public virtual object GetContextItem(GetKnownOptions options) { Assert.IsNotNull(options, "options must no be null"); options.Item = ContextItem; return(SitecoreService.GetItem(options)); }
/// <summary> /// Returns the Data Source Item as strongly typed /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> protected virtual T GetDataSource <T>(GetKnownOptions options = null) where T : class { if (!MvcContext.HasDataSource) { return(null); } return(MvcContext.GetDataSourceItem <T>(options ?? new GetKnownOptions())); }
/// <summary> /// Maps the Sitecore.Context.Site.StartPath to a model /// </summary> /// <typeparam name="T">The type to return</typeparam> /// <param name="options">Options for how the model will be retrieved</param> /// <returns></returns> public virtual T GetHomeItem <T>(GetKnownOptions options) where T : class { Assert.IsNotNull(options, "options must no be null"); var item = SitecoreService.Database.GetItem(Sitecore.Context.Site.StartPath); options.Item = item; return(SitecoreService.GetItem <T>(options)); }
/// <summary> /// Maps the data source of the control to a model /// </summary> /// <typeparam name="T">The type to return</typeparam> /// <param name="options">Options for how the model will be mapped</param> /// <returns></returns> public T GetDataSourceItem <T>(Control control, GetKnownOptions options) where T : class { Assert.IsNotNull(options, "options must no be null"); var item = GetDataSourceItem(control); options.Item = item; return(SitecoreService.GetItem <T>(options)); }
/// <summary> /// Maps the RenderingContext.CurrentOrNull.Rendering.DataSource to a model /// </summary> /// <typeparam name="T">The type to return</typeparam> /// <param name="options">Options for how the model will be mapped</param> /// <returns></returns> public virtual T GetDataSourceItem <T>(GetKnownOptions options) where T : class { Assert.IsNotNull(options, "options must not be null"); var item = DataSourceItem; options.Item = item; return(SitecoreService.GetItem <T>(options)); }
/// <summary> /// Maps the RenderingContext.CurrentOrNull.Rendering.Item to a model /// </summary> /// <typeparam name="T">The type to return</typeparam> /// <param name="options">Options for how the model will be retrieved</param> /// <returns></returns> public virtual T GetRenderingItem <T>(GetKnownOptions options) where T : class { Assert.IsNotNull(options, "options must not be null"); var item = RenderingContext.CurrentOrNull.Rendering.Item; options.Item = item; return(SitecoreService.GetItem <T>(options)); }
/// <summary> /// Returns the DataSource item or the Context Item as strongly typed /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T GetLayoutItem <T>(GetKnownOptions options = null) where T : class { var dataSource = WebContext.GetDataSourceItem(this); if (dataSource != null) { return(GetDataSource <T>(options)); } else { return(GetContext <T>(options)); } }
/// <summary> /// Returns the Context Item as strongly typed /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> protected virtual T GetContext <T>(GetKnownOptions options = null) where T : class { return(MvcContext.GetContextItem <T>(options ?? new GetKnownOptions())); }
/// <summary> /// Returns the Layout Item as strongly typed /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> protected virtual T GetLayout <T>(GetKnownOptions options = null) where T : class { return(MvcContext.HasDataSource ? GetDataSource <T>(options ?? new GetKnownOptions()) : GetContext <T>(options ?? new GetKnownOptions())); }
public new T GetLayout <T>(GetKnownOptions options = null) where T : class { return(base.GetLayout <T>(options)); }
public new T GetDataSource <T>(GetKnownOptions options = null) where T : class { return(base.GetDataSource <T>(options)); }
/// <summary> /// Returns the Context Item as strongly typed /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T GetContext <T>(GetKnownOptions options = null) where T : class { return(MvcContext.GetContextItem <T>(options ?? new GetKnownOptions())); }
public T GetPageContextItem <T>(GetKnownOptions options) where T : class { return(_mvcContext.GetPageContextItem <T>(options)); }
public T GetHomeItem <T>(GetKnownOptions options) where T : class { throw new NotImplementedException(); }
/// <summary> /// Returns the Data Source Item as strongly typed /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T GetDataSource <T>(GetKnownOptions options = null) where T : class { options = options == null ? new GetKnownOptions() : options; return(WebContext.GetDataSourceItem <T>(this, options)); }
/// <summary> /// Returns the Context Item as strongly typed /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T GetContext <T>(GetKnownOptions options = null) where T : class { options = options == null ? new GetKnownOptions() : options; return(WebContext.GetContextItem <T>(options)); }
protected AbstractGetKnownItemBuilder(GetKnownOptions options) : base(options) { _options = options; }
public T GetContext <T>(GetKnownOptions options = null) where T : class { return(base.GetContext <T>(options)); }
public T GetHomeItem<T>(GetKnownOptions options) where T : class { return _requestContext.GetHomeItem<T>(options); }
public object GetContextItem(GetKnownOptions options) { throw new NotImplementedException(); }
public object GetCurrentItem(GetKnownOptions options) { return(_requestContext.GetContextItem(options)); }
public T GetDataSourceItem <T>(GetKnownOptions options) where T : class { return(_mvcContext.GetDataSourceItem <T>(options)); }
public T GetRootItem <T>(GetKnownOptions options) where T : class { return(_requestContext.GetRootItem <T>(options)); }
public T GetRenderingItem <T>(GetKnownOptions options) where T : class { return(_mvcContext.GetRenderingItem <T>(options)); }
protected virtual TModel GetModel(GetKnownOptions options = null) { return(GetLayout <TModel>(options ?? new GetKnownOptions())); }