/// <summary> /// Configures the specified type. /// </summary> /// <param name="type">The type.</param> /// <param name="config">The config.</param> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Type configuration is not of type {0}.Formatted(typeof (SitecoreTypeConfiguration).FullName)</exception> public override AbstractTypeConfiguration Configure(Type type) { var scConfig = new SitecoreTypeConfiguration(); if (scConfig == null) throw new ConfigurationException( "Type configuration is not of type {0}".Formatted(typeof (SitecoreTypeConfiguration).FullName)); if (BranchId.IsNotNullOrEmpty()) scConfig.BranchId = new ID(this.BranchId); else scConfig.BranchId = ID.Null; if (TemplateId.IsNotNullOrEmpty()) scConfig.TemplateId = new ID(this.TemplateId); else scConfig.TemplateId = ID.Null; scConfig.CodeFirst = this.CodeFirst; scConfig.TemplateName = this.TemplateName; base.Configure(type, scConfig); return scConfig; }
public void Execute_EnforeTemplateOnlyDoesNotInheritTemplate_NextNotCalled() { //Arrange var task = new EnforcedTemplateCheck(); bool nextCalled = false; task.SetNext(x => nextCalled = true); using (Db database = new Db { new DbTemplate(new ID(TemplateInferredTypeTaskFixture.StubInferred.TemplateId)), new Sitecore.FakeDb.DbItem("Target", ID.NewID, new ID(TemplateInferredTypeTaskFixture.StubInferred.TemplateId)) }) { var path = "/sitecore/content/Target"; var item = database.GetItem(path); var config = new SitecoreTypeConfiguration(); config.EnforceTemplate = SitecoreEnforceTemplate.Template; config.TemplateId = new ID(Guid.NewGuid()); var typeContext = new SitecoreTypeCreationContext(); typeContext.Item = item; var args = new ObjectConstructionArgs(null, typeContext, config, null, new ModelCounter()); //Act task.Execute(args); //Assert Assert.IsNull(args.Result); Assert.IsFalse(nextCalled); } }
public void ResolveItem() { //Arrange using (Db database = new Db { new Sitecore.FakeDb.DbItem("TestItem") }) { var config = new SitecoreTypeConfiguration(); config.ItemUriConfig = new SitecoreInfoConfiguration(); config.ItemUriConfig.PropertyInfo = typeof(StubClass).GetProperty("ItemUri"); string path = "/sitecore/content/TestItem"; var expected = database.GetItem(path); var instance = new StubClass(); instance.ItemUri = new ItemUri(expected.ID, expected.Language, expected.Version, expected.Database); //Act var result = config.ResolveItem(instance, database.Database); //Assert Assert.AreEqual(expected.ID, result.ID); Assert.AreEqual(expected.Version, result.Version); Assert.AreEqual(expected.Language, result.Language); } }
/// <summary> /// Creates the template item. /// </summary> /// <param name="db">The db.</param> /// <param name="config">The config.</param> /// <param name="type">The type.</param> /// <param name="sqlDataProvider">The SQL data provider.</param> /// <param name="containingFolder">The containing folder.</param> /// <param name="context">The context.</param> /// <returns></returns> /// <exception cref="Sitecore.Exceptions.RequiredObjectIsNullException">TemplateItem is null for ID {0}.Formatted(templateDefinition.ID)</exception> private ItemDefinition CreateTemplateItem( Database db, SitecoreTypeConfiguration config, Type type, DataProvider sqlDataProvider, ItemDefinition containingFolder, CallContext context) { //create the template in Sitecore string templateName = string.IsNullOrEmpty(config.TemplateName) ? type.Name : config.TemplateName; sqlDataProvider.CreateItem(config.TemplateId, templateName, TemplateTemplateId, containingFolder, context); var templateDefinition = sqlDataProvider.GetItemDefinition(config.TemplateId, context); ClearCaches(db); var templateItem = db.GetItem(templateDefinition.ID); if (templateItem == null) { throw new RequiredObjectIsNullException("TemplateItem is null for ID {0}".Formatted(templateDefinition.ID)); } using (new ItemEditing(templateItem, true)) { templateItem["__Base template"] = "{1930BBEB-7805-471A-A3BE-4858AC7CF696}"; } return(templateDefinition); }
/// <summary> /// Initializes a new instance of the <see cref="SitecoreType{T}"/> class. /// </summary> public SitecoreType() { Configuration = new SitecoreTypeConfiguration(); Configuration.Type = typeof(T); Configuration.ConstructorMethods = Utilities.CreateConstructorDelegates(Configuration.Type); }
static SitecoreItemResolverTask() { ItemType = typeof(Item); Config = new SitecoreTypeConfiguration() { Type = ItemType }; }
public void Execute_EnforeTemplateAndBaseInheritsTemplateFromDeepBase_PipelineContinues() { //Arrange var task = new EnforcedTemplateCheck(); bool nextCalled = false; task.SetNext(x => nextCalled = true); ID baseTemplateId1 = ID.NewID; ID baseTemplateId2 = ID.NewID; using (Db database = new Db { new DbTemplate(new ID(TemplateInferredTypeTaskFixture.StubInferred.TemplateId)) { new DbField("__Base template") { Value = baseTemplateId1.ToString() } }, new Sitecore.FakeDb.DbTemplate("base1", baseTemplateId1) { new DbField("__Base template") { Value = baseTemplateId2.ToString() } }, new Sitecore.FakeDb.DbTemplate("base2", baseTemplateId2), new Sitecore.FakeDb.DbItem("Target", ID.NewID, new ID(TemplateInferredTypeTaskFixture.StubInferred.TemplateId)) }) { var path = "/sitecore/content/Target"; var item = database.GetItem(path); var config = new SitecoreTypeConfiguration(); config.EnforceTemplate = SitecoreEnforceTemplate.TemplateAndBase; using (new SecurityDisabler()) { config.TemplateId = item.Template.BaseTemplates.First().BaseTemplates.First().ID; var typeContext = new SitecoreTypeCreationContext(); typeContext.Item = item; var args = new ObjectConstructionArgs(null, typeContext, config, null); //Act task.Execute(args); //Assert Assert.IsNull(args.Result); Assert.IsTrue(nextCalled); } } }
/// <summary> /// Configures the specified type. /// </summary> /// <param name="type">The type.</param> /// <param name="config">The config.</param> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Type configuration is not of type {0}.Formatted(typeof (SitecoreTypeConfiguration).FullName)</exception> public override AbstractTypeConfiguration Configure(Type type) { var scConfig = new SitecoreTypeConfiguration(); if (scConfig == null) { throw new ConfigurationException( "Type configuration is not of type {0}".Formatted(typeof(SitecoreTypeConfiguration).FullName)); } try { if (BranchId.HasValue()) { scConfig.BranchId = new ID(this.BranchId); } else { scConfig.BranchId = ID.Null; } } catch (Exception ex) { throw new MapperException("Failed to convert BranchId for type {0}. Value was {1}".Formatted(type.FullName, this.TemplateId), ex); } try { if (TemplateId.HasValue()) { scConfig.TemplateId = new ID(this.TemplateId); } else { scConfig.TemplateId = ID.Null; } } catch (Exception ex) { throw new MapperException("Failed to convert TemplateId for type {0}. Value was {1}".Formatted(type.FullName, this.TemplateId), ex); } if (TemplateId.IsNullOrEmpty() && this.EnforceTemplate.IsEnabled()) { throw new ConfigurationException( "The type {0} has EnforceTemplate set to true but no TemplateId".Formatted(type.FullName)); } scConfig.EnforceTemplate = this.EnforceTemplate; scConfig.TemplateName = this.TemplateName; scConfig.Cache = this.Cache; base.Configure(type, scConfig); return(scConfig); }
/// <summary> /// Bases the template checks. /// </summary> /// <param name="template">The template.</param> /// <param name="provider">The provider.</param> /// <param name="context">The context.</param> /// <param name="config">The config.</param> private void BaseTemplateChecks( ItemDefinition template, DataProvider provider, CallContext context, SitecoreTypeConfiguration config) { //check base templates var templateItem = Factory.GetDatabase("master").GetItem(template.ID); var baseTemplatesField = templateItem[FieldIDs.BaseTemplate]; StringBuilder sb = new StringBuilder(baseTemplatesField); global::Sitecore.Diagnostics.Log.Info("Type {0}".Formatted(config.Type.FullName), this); Action<Type> idCheck = (type) => { global::Sitecore.Diagnostics.Log.Info("ID Check {0}".Formatted(type.FullName), this); if (!_typeConfigurations.ContainsKey(type)) return; var baseConfig = _typeConfigurations[type]; if (baseConfig != null && baseConfig.CodeFirst) { if (!baseTemplatesField.Contains(baseConfig.TemplateId.ToString())) { sb.Append("|{0}".Formatted(baseConfig.TemplateId)); } } }; Type baseType = config.Type.BaseType; while (baseType != null) { idCheck(baseType); baseType = baseType.BaseType; } config.Type.GetInterfaces().ForEach(x => idCheck(x)); if (baseTemplatesField != sb.ToString()) { templateItem.Editing.BeginEdit(); templateItem[FieldIDs.BaseTemplate] = sb.ToString(); templateItem.Editing.EndEdit(); } }
/// <summary> /// Gets the child I ds template. /// </summary> /// <param name="template">The template.</param> /// <param name="itemDefinition">The item definition.</param> /// <param name="context">The context.</param> /// <param name="sqlProvider">The SQL provider.</param> /// <returns> /// IDList. /// </returns> private IDList GetChildIDsTemplate(SitecoreTypeConfiguration template, ItemDefinition itemDefinition, CallContext context, DataProvider sqlProvider) { var fields = new IDList(); var processed = new List <string>(); var sections = template.Properties .Where(x => x.PropertyInfo.DeclaringType == template.Type) .OfType <SitecoreFieldConfiguration>() .Select(x => new { x.SectionName, x.SectionSortOrder }); //If sitecore contains a section with the same name in the database, use that one instead of creating a new one var existing = sqlProvider.GetChildIDs(itemDefinition, context).OfType <ID>().Select(id => sqlProvider.GetItemDefinition(id, context)) .Where(item => item.TemplateID == SectionTemplateId).ToList(); foreach (var section in sections) { if (processed.Contains(section.SectionName) || section.SectionName.IsNullOrEmpty()) { continue; } var record = SectionTable.FirstOrDefault(x => x.TemplateId == itemDefinition.ID && x.Name == section.SectionName); if (record == null) { var exists = existing.FirstOrDefault(def => def.Name.Equals(section.SectionName, StringComparison.InvariantCultureIgnoreCase)); var newId = GetUniqueGuid(itemDefinition.ID + section.SectionName); const int newSortOrder = 100; record = exists != null ? new SectionInfo(section.SectionName, exists.ID, itemDefinition.ID, section.SectionSortOrder) { Existing = true } : new SectionInfo(section.SectionName, new ID(newId), itemDefinition.ID, newSortOrder); SectionTable.Add(record); } processed.Add(section.SectionName); if (!record.Existing) { fields.Add(record.SectionId); } } //we need to add sections already in the db, 'cause we have to foreach (var sqlOne in existing.Where(ex => SectionTable.All(s => s.SectionId != ex.ID))) { SectionTable.Add(new SectionInfo(sqlOne.Name, sqlOne.ID, itemDefinition.ID, 0) { Existing = true }); } return(fields); }
/// <summary> /// Bases the template checks. /// </summary> /// <param name="template">The template.</param> /// <param name="config">The config.</param> /// <param name="db">The database.</param> private void BaseTemplateChecks( ItemDefinition template, SitecoreTypeConfiguration config, Database db) { //check base templates var templateItem = db.GetItem(template.ID); var baseTemplatesField = templateItem[FieldIDs.BaseTemplate]; var sb = new StringBuilder(baseTemplatesField); Sitecore.Diagnostics.Log.Info("Type {0}".Formatted(config.Type.FullName), this); Action <Type> idCheck = type => { Sitecore.Diagnostics.Log.Info("ID Check {0}".Formatted(type.FullName), this); if (!TypeConfigurations.ContainsKey(type)) { return; } var baseConfig = TypeConfigurations[type]; if (baseConfig != null && baseConfig.TemplateId.Guid != Guid.Empty) { if (!baseTemplatesField.Contains(baseConfig.TemplateId.ToString())) { sb.Append("|{0}".Formatted(baseConfig.TemplateId)); } } }; Type baseType = config.Type.BaseType; while (baseType != null) { idCheck(baseType); baseType = baseType.BaseType; } config.Type.GetInterfaces().ForEach(idCheck); //dirty fix for circular template inheritance var baseTemplates = sb.ToString().Split('|').ToList(); baseTemplates.Remove(config.TemplateId.ToString()); sb.Clear(); sb.Append(string.Join("|", baseTemplates)); if (baseTemplatesField != sb.ToString()) { templateItem.Editing.BeginEdit(); templateItem[FieldIDs.BaseTemplate] = sb.ToString(); templateItem.Editing.EndEdit(); } }
/// <summary> /// Configures the specified type. /// </summary> /// <param name="type">The type.</param> /// <param name="config">The config.</param> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Type configuration is not of type {0}.Formatted(typeof (SitecoreTypeConfiguration).FullName)</exception> public override AbstractTypeConfiguration Configure(Type type) { var scConfig = new SitecoreTypeConfiguration(); if (scConfig == null) throw new ConfigurationException( "Type configuration is not of type {0}".Formatted(typeof(SitecoreTypeConfiguration).FullName)); try { if (BranchId.IsNotNullOrEmpty()) scConfig.BranchId = new ID(this.BranchId); else scConfig.BranchId = ID.Null; } catch (Exception ex) { throw new MapperException("Failed to convert BranchId for type {0}. Value was {1}".Formatted(type.FullName, this.TemplateId), ex); } try { if (TemplateId.IsNotNullOrEmpty()) scConfig.TemplateId = new ID(this.TemplateId); else scConfig.TemplateId = ID.Null; } catch (Exception ex) { throw new MapperException("Failed to convert TemplateId for type {0}. Value was {1}".Formatted(type.FullName, this.TemplateId), ex); } if (TemplateId.IsNullOrEmpty() && this.EnforceTemplate != SitecoreEnforceTemplate.No) { throw new ConfigurationException( "The type {0} has EnforceTemplate set to true but no TemplateId".Formatted(type.FullName)); } scConfig.EnforceTemplate = this.EnforceTemplate; scConfig.CodeFirst = this.CodeFirst; scConfig.TemplateName = this.TemplateName; base.Configure(type, scConfig); return scConfig; }
public void Execute_RequestedTypeItem_ConfigForItem() { //Arrange SitecoreTypeConfiguration expected = SitecoreItemResolverTask.Config; var task = new SitecoreItemResolverTask(); var args = new ConfigurationResolverArgs(null, null, typeof(Item), null); //Act task.Execute(args); //Arrange Assert.AreEqual(expected, args.Result); }
public void Execute_ResultIsNotNull_DoesNothing() { //Arrange var expected = new SitecoreTypeConfiguration(); var task = new SitecoreItemResolverTask(); var args = new ConfigurationResolverArgs(null, null, null); args.Result = expected; //Act task.Execute(args); //Arrange Assert.AreEqual(expected, args.Result); }
public void Execute_ResultNotNull_Returns() { //Arrange var args = new ConfigurationResolverArgs(null, null, null); var task = new TemplateInferredTypeTask(); var expected = new SitecoreTypeConfiguration(); args.Result = expected; //Act task.Execute(args); //Assert Assert.AreEqual(expected, args.Result); }
/// <summary> /// Bases the template checks. /// </summary> /// <param name="template">The template.</param> /// <param name="config">The config.</param> /// <param name="db">The database.</param> private void BaseTemplateChecks( ItemDefinition template, SitecoreTypeConfiguration config, Database db) { //check base templates var templateItem = db.GetItem(template.ID); var baseTemplatesField = templateItem[FieldIDs.BaseTemplate]; var sb = new StringBuilder(baseTemplatesField); Sitecore.Diagnostics.Log.Info("Type {0}".Formatted(config.Type.FullName), this); Action <Type> idCheck = type => { Sitecore.Diagnostics.Log.Info("ID Check {0}".Formatted(type.FullName), this); if (!TypeConfigurations.ContainsKey(type)) { return; } var baseConfig = TypeConfigurations[type]; if (baseConfig != null && baseConfig.CodeFirst) { if (!baseTemplatesField.Contains(baseConfig.TemplateId.ToString())) { sb.Append("|{0}".Formatted(baseConfig.TemplateId)); } } }; Type baseType = config.Type.BaseType; while (baseType != null) { idCheck(baseType); baseType = baseType.BaseType; } config.Type.GetInterfaces().ForEach(idCheck); if (baseTemplatesField != sb.ToString()) { templateItem.Editing.BeginEdit(); templateItem[FieldIDs.BaseTemplate] = sb.ToString(); templateItem.Editing.EndEdit(); } }
/// <summary> /// Gets the child I ds template. /// </summary> /// <param name="template">The template.</param> /// <param name="itemDefinition">The item definition.</param> /// <param name="context">The context.</param> /// <returns>IDList.</returns> private IDList GetChildIDsTemplate(SitecoreTypeConfiguration template, ItemDefinition itemDefinition, CallContext context) { IDList fields = new IDList(); List <string> processed = new List <string>(); var sections = template.Properties .Where(x => x.PropertyInfo.DeclaringType == template.Type) .OfType <SitecoreFieldConfiguration>() .Select(x => new { x.SectionName, x.SectionSortOrder }); var providers = context.DataManager.Database.GetDataProviders(); var otherProvider = providers.FirstOrDefault(x => !(x is GlassDataProvider)); //If sitecore contains a section with the same name in the database, use that one instead of creating a new one var existing = otherProvider.GetChildIDs(itemDefinition, context).OfType <ID>().Select(id => otherProvider.GetItemDefinition(id, context)).ToList(); foreach (var section in sections) { if (processed.Contains(section.SectionName) || section.SectionName.IsNullOrEmpty()) { continue; } var record = SectionTable.FirstOrDefault(x => x.TemplateId == itemDefinition.ID && x.Name == section.SectionName); if (record == null) { var exists = existing.FirstOrDefault(def => def.Name.Equals(section)); if (exists != null) { record = new SectionInfo(section.SectionName, exists.ID, itemDefinition.ID, section.SectionSortOrder) { Existing = true }; } else { record = new SectionInfo(section.SectionName, new ID(Guid.NewGuid()), itemDefinition.ID, section.SectionSortOrder); } SectionTable.Add(record); } processed.Add(section.SectionName); if (!record.Existing) { fields.Add(record.SectionId); } } return(fields); }
public void Configure_AttributeHasInvalidBranchId_ExceptionThrown() { //Assign var attr = new SitecoreTypeAttribute(); var config = new SitecoreTypeConfiguration(); var type = typeof(StubClass); var templateIdExpected = Guid.Empty; var branchIdExptected = Guid.Empty; attr.BranchId = "not a guid"; //Act attr.Configure(type, config); //Assert }
public void Execute_EnforeTemplateNo_PipelineNotAborted() { //Arrange var task = new EnforcedTemplateCheck(); var config = new SitecoreTypeConfiguration(); config.EnforceTemplate = SitecoreEnforceTemplate.No; var args = new ObjectConstructionArgs(null, null, config, null); //Act task.Execute(args); //Assert Assert.IsNull(args.Result); Assert.IsFalse(args.IsAborted); }
public void Intercept(IInvocation invocation) { if (IndexFields.Any(x => x == invocation.Method.Name)) { invocation.Proceed(); } if (!invocation.Method.IsSpecialName || !invocation.Method.Name.StartsWith("get_") && !invocation.Method.Name.StartsWith("set_")) { return; } string str = invocation.Method.Name.Substring(0, 4); string name = invocation.Method.Name.Substring(4); if (!_isLoaded) { SitecoreTypeCreationContext typeCreationContext = _args.AbstractTypeCreationContext as SitecoreTypeCreationContext; typeCreationContext.Item = typeCreationContext.SitecoreService.Database.GetItem(Id); SitecoreTypeConfiguration typeConfiguration = TypeConfiguration; AbstractDataMappingContext dataMappingContext = _args.Service.CreateDataMappingContext(_args.AbstractTypeCreationContext, null); //todo filter fieldnames from FieldConfigs! foreach (AbstractPropertyConfiguration propertyConfiguration in typeConfiguration.Properties.Where(x => IndexFields.All(y => y != x.PropertyInfo.Name))) { object obj = propertyConfiguration.Mapper.MapToProperty(dataMappingContext); _values[propertyConfiguration.PropertyInfo.Name] = obj; } _isLoaded = true; } if (str == "get_") { if (_values.ContainsKey(name)) { object obj = _values[name]; invocation.ReturnValue = obj; } } else if (str == "set_") { _values[name] = invocation.Arguments[0]; } else { throw new MapperException(Glass.Mapper.ExtensionMethods.Formatted("Method with name {0}{1} on type {2} not supported.", (object)str, (object)name, (object)this._args.Configuration.Type.FullName)); } }
/// <summary> /// Configures the specified type. /// </summary> /// <param name="type">The type.</param> /// <param name="config">The config.</param> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Type configuration is not of type {0}.Formatted(typeof (SitecoreTypeConfiguration).FullName)</exception> public override AbstractTypeConfiguration Configure(Type type) { var scConfig = new SitecoreTypeConfiguration(); if (scConfig == null) { throw new ConfigurationException( "Type configuration is not of type {0}".Formatted(typeof(SitecoreTypeConfiguration).FullName)); } if (BranchId.IsNotNullOrEmpty()) { scConfig.BranchId = new ID(this.BranchId); } else { scConfig.BranchId = ID.Null; } if (TemplateId.IsNotNullOrEmpty()) { scConfig.TemplateId = new ID(this.TemplateId); } else { scConfig.TemplateId = ID.Null; } if (TemplateId.IsNullOrEmpty() && this.EnforceTemplate != SitecoreEnforceTemplate.No) { throw new ConfigurationException( "The type {0} has EnforceTemplate set to true but no TemplateId".Formatted(type.FullName)); } scConfig.EnforceTemplate = this.EnforceTemplate; scConfig.CodeFirst = this.CodeFirst; scConfig.TemplateName = this.TemplateName; base.Configure(type, scConfig); return(scConfig); }
public void Configure_ConfigurationIsOfCorrectType_NoExceptionThrown() { //Assign var attr = new SitecoreTypeAttribute(); var config = new SitecoreTypeConfiguration(); var type = typeof(StubClass); var templateIdExpected = Guid.Empty; var branchIdExptected = Guid.Empty; //Act attr.Configure(type, config); //Assert Assert.AreEqual(type, config.Type); Assert.AreEqual(new ID(templateIdExpected), config.TemplateId); Assert.AreEqual(new ID(branchIdExptected), config.BranchId); }
public void Execute_EnforeTemplateNo_NextCalled() { //Arrange var task = new EnforcedTemplateCheck(); var config = new SitecoreTypeConfiguration(); config.EnforceTemplate = SitecoreEnforceTemplate.No; bool nextCalled = false; task.SetNext(x => nextCalled = true); var args = new ObjectConstructionArgs(null, new StubAbstractTypeCreationContext(), config, null); //Act task.Execute(args); //Assert Assert.IsNull(args.Result); Assert.IsTrue(nextCalled); }
public void Configure_AttributeHasTemplateId_TemplateIdSetOnConfig() { //Assign var attr = new SitecoreTypeAttribute(); var config = new SitecoreTypeConfiguration(); var type = typeof(StubClass); var templateIdExpected = new Guid(); var branchIdExptected = Guid.Empty; attr.TemplateId = templateIdExpected.ToString(); //Act attr.Configure(type, config); //Assert Assert.AreEqual(type, config.Type); Assert.AreEqual(new ID(templateIdExpected), config.TemplateId); Assert.AreEqual(new ID(branchIdExptected), config.BranchId); }
public void Execute_RequestedTypeItem_ConfigForItem() { //Arrange SitecoreTypeConfiguration expected = SitecoreItemResolverTask.Config; var task = new SitecoreItemResolverTask(); var context = new SitecoreTypeCreationContext(); context.Options = new GetItemOptions() { Type = typeof(Item) }; var args = new ConfigurationResolverArgs(null, context, null); //Act task.Execute(args); //Arrange Assert.AreEqual(expected, args.Result); }
/// <summary> /// Initializes a new instance of the <see cref="SitecoreInfo{T}"/> class. /// </summary> /// <param name="ex">The ex.</param> public SitecoreInfo(Expression <Func <T, object> > ex, SitecoreTypeConfiguration owner) : base(ex) { _owner = owner; }
/// <summary> /// The type of information that should populate the property /// </summary> /// <param name="type">The type.</param> /// <returns>SitecoreInfo{`0}.</returns> public SitecoreInfo <T> InfoType(SitecoreInfoType type) { Configuration.Type = type; SitecoreTypeConfiguration.AssignInfoToKnownProperty(_owner, Configuration); return(this); }