/// <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 void Configure(Type type, Mapper.Configuration.AbstractTypeConfiguration config) { var scConfig = config as 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, config); }
/// <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); }