protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as SitecoreInfoConfiguration; config.Type = Type; config.UrlOptions = UrlOptions; config.MediaUrlOptions = MediaUrlOptions; base.Copy(copy); }
protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as IdConfiguration; config.Type = Type; base.Copy(copy); }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public virtual void AddProperty(AbstractPropertyConfiguration property) { if(_properties.Any(x=>x.PropertyInfo.Name == property.PropertyInfo.Name)) throw new MapperException("You can not have duplicate mappings for properties. Property Name: {0} Type: {0}".Formatted(property.PropertyInfo.Name, this.Type.Name)); if(property != null) _properties.Add(property); }
protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as SitecoreDelegateConfiguration; config.MapToCmsAction = MapToCmsAction; config.MapToPropertyAction = MapToPropertyAction; base.Copy(copy); }
public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { Type type = configuration.PropertyInfo.PropertyType; if (!type.IsGenericType) return false; if (type.GetGenericTypeDefinition() != typeof(GlassLazy<>)) return false; return true; }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public override void AddProperty(AbstractPropertyConfiguration property) { if (property is UmbracoIdConfiguration) IdConfig = property as UmbracoIdConfiguration; var infoProperty = property as UmbracoInfoConfiguration; if (infoProperty != null && infoProperty.Type == UmbracoInfoType.Version) VersionConfig = infoProperty; base.AddProperty(property); }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public virtual void AddProperty(AbstractPropertyConfiguration property) { if (_properties.Any(x => x.PropertyInfo.Name == property.PropertyInfo.Name)) { throw new MapperException("You can not have duplicate mappings for properties. Property Name: {0} Type: {0}".Formatted(property.PropertyInfo.Name, Type.Name)); } if (property != null) { _properties.Add(property); } }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public virtual void AddProperty(AbstractPropertyConfiguration property) { if (property != null) { var currentProperty = _properties.FirstOrDefault(x => x.PropertyInfo.Name == property.PropertyInfo.Name); if (currentProperty != null) { _properties.Remove(currentProperty); } _properties.Add(property); } }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public virtual void AddProperty(AbstractPropertyConfiguration property) { if (property != null) { if (_properties.Any(x => x.PropertyInfo.Name == property.PropertyInfo.Name)) { throw new MapperException( "You cannot have duplicate mappings for properties. Property Name: {0} Type: {0}".Formatted( property.PropertyInfo.Name, Type.Name)); } _properties = _properties.Concat(new[] { property }).ToArray(); _propertMappingExpression = CreatePropertyExpression(property); } }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public override void AddProperty(AbstractPropertyConfiguration property) { if (property is SitecoreIdConfiguration) IdConfig = property as SitecoreIdConfiguration; var infoProperty = property as SitecoreInfoConfiguration; if (infoProperty != null && infoProperty.Type == SitecoreInfoType.Language) LanguageConfig = infoProperty; else if (infoProperty != null && infoProperty.Type == SitecoreInfoType.Version) VersionConfig = infoProperty; base.AddProperty(property); }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public virtual void AddProperty(AbstractPropertyConfiguration property) { if (property != null) { var key = property.PropertyInfo.Name; if (property.PropertyInfo.GetMethod != null && property.PropertyInfo.GetMethod.IsPrivate) { _privateProperties[key] = property; } else { _properties[key] = property; } } }
protected virtual Action <object, AbstractDataMappingContext> CreatePropertyExpression( AbstractPropertyConfiguration property) { var next = _propertMappingExpression; return((obj, context) => { try { property.Mapper.MapCmsToProperty(context); } catch (Exception e) { throw new MapperException( "Failed to map property {0} on {1}".Formatted(property.PropertyInfo.Name, property.PropertyInfo.DeclaringType.FullName), e); } next(obj, context); }); }
/// <summary> /// Determines whether this instance can handle the specified configuration. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="context">The context.</param> /// <returns><c>true</c> if this instance can handle the specified configuration; otherwise, <c>false</c>.</returns> public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { var fieldConfiguration = configuration as SitecoreFieldConfiguration; if (fieldConfiguration == null) { return false; } Type propertyType = fieldConfiguration.PropertyInfo.PropertyType; return propertyType.IsGenericType && (!(propertyType.GetGenericTypeDefinition() != typeof(IDictionary<,>))); }
protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as SitecoreNodeConfiguration; base.Copy(copy); }
protected virtual void Copy(AbstractPropertyConfiguration copy) { copy.PropertyInfo = PropertyInfo; }
public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { throw new NotImplementedException(); }
protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as UmbracoIdConfiguration; base.Copy(copy); }
private void LoadValue(AbstractPropertyConfiguration propertyConfiguration) { if (_mapRequested == false) { _mapRequested = true; _args.Counters.ModelsMapped++; } if (!Values.ContainsKey(propertyConfiguration.PropertyInfo.Name)) { var result = propertyConfiguration.Mapper.MapToProperty(_mappingContext) ?? Utilities.GetDefault(propertyConfiguration.PropertyInfo.PropertyType); Values[propertyConfiguration.PropertyInfo.Name] = result; } }
public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { return false; }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public override void AddProperty(AbstractPropertyConfiguration property) { if (property is SitecoreIdConfiguration) IdConfig = property as SitecoreIdConfiguration; var infoProperty = property as SitecoreInfoConfiguration; if (infoProperty != null) { switch (infoProperty.Type) { case SitecoreInfoType.Language: LanguageConfig = infoProperty; break; case SitecoreInfoType.Version: VersionConfig = infoProperty; break; case SitecoreInfoType.ItemUri: ItemUriConfig = infoProperty; break; } } if (property is SitecoreItemConfiguration) ItemConfig = property as SitecoreItemConfiguration; base.AddProperty(property); }
/// <summary> /// Indicates that the data mapper will mapper to and from the property /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="context">The context.</param> /// <returns><c>true</c> if this instance can handle the specified configuration; otherwise, <c>false</c>.</returns> public abstract bool CanHandle(AbstractPropertyConfiguration configuration, Context context);
public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { return configuration is SitecoreItemConfiguration && configuration.PropertyInfo.PropertyType == typeof (Item); }
/// <summary> /// Indicates that the data mapper will mapper to and from the property /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="context">The context.</param> /// <returns><c>true</c> if this instance can handle the specified configuration; otherwise, <c>false</c>.</returns> public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { if (!(configuration is SitecoreQueryConfiguration)) return false; if (configuration.PropertyInfo.PropertyType.IsGenericType) { Type outerType = Utilities.GetGenericOuter(configuration.PropertyInfo.PropertyType); Type innerType = Utilities.GetGenericArgument(configuration.PropertyInfo.PropertyType); return typeof (IEnumerable<>) == outerType;// && context.TypeConfigurations.ContainsKey(innerType); } else { //We are now assuming auto-mapping works return true; //return context.TypeConfigurations.ContainsKey(configuration.PropertyInfo.PropertyType); } }
/// <summary> /// Indicates that the data mapper will mapper to and from the property /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="context">The context.</param> /// <returns><c>true</c> if this instance can handle the specified configuration; otherwise, <c>false</c>.</returns> public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { return configuration is SitecoreNodeConfiguration;// && context.TypeConfigurations.ContainsKey(configuration.PropertyInfo.PropertyType); }
protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as SitecoreLinkedConfiguration; config.Option = Option; base.Copy(copy); }
protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as SitecoreQueryConfiguration; config.UseQueryContext = UseQueryContext; base.Copy(copy); }
public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { return configuration is UmbracoDelegateConfiguration; }
protected override void Copy(AbstractPropertyConfiguration copy) { var config = copy as SitecoreFieldConfiguration; config.CodeFirst = this.CodeFirst; config.FieldId = this.FieldId; config.FieldName = this.FieldName; config.FieldSource = this.FieldSource; config.FieldTitle = this.FieldTitle; config.FieldType = this.FieldType; config.IsShared = this.IsShared; config.IsUnversioned = this.IsUnversioned; config.SectionName = this.SectionName; config.Setting = this.Setting; config.CustomFieldType = this.CustomFieldType; base.Copy(copy); }
public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { return configuration is SitecoreSelfConfiguration; }
/// <summary> /// Sets up the data mapper for a particular property /// </summary> /// <param name="args">The args.</param> public virtual void Setup(DataMapperResolverArgs args) { Configuration = args.PropertyConfiguration; }
/// <summary> /// Indicates that the data mapper will mapper to and from the property /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="context">The context.</param> /// <returns><c>true</c> if this instance can handle the specified configuration; otherwise, <c>false</c>.</returns> public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { if (!(configuration is SitecoreLinkedConfiguration)) return false; if (!configuration.PropertyInfo.PropertyType.IsGenericType) return false; Type outerType = Utilities.GetGenericOuter(configuration.PropertyInfo.PropertyType); Type innerType = Utilities.GetGenericArgument(configuration.PropertyInfo.PropertyType); return typeof (IEnumerable<>) == outerType;// && context.TypeConfigurations.ContainsKey(innerType); }
protected virtual Action<object, AbstractDataMappingContext> CreatePropertyExpression( AbstractPropertyConfiguration property) { var next = _propertMappingExpression; return (obj, context) => { try { property.Mapper.MapCmsToProperty(context); } catch (Exception e) { throw new MapperException( "Failed to map property {0} on {1}".Formatted(property.PropertyInfo.Name, property.PropertyInfo.DeclaringType.FullName), e); } next(obj, context); }; }
public override bool CanHandle(AbstractPropertyConfiguration configuration, Context context) { var underlyingType = Nullable.GetUnderlyingType(configuration.PropertyInfo.PropertyType); return underlyingType != null && underlyingType.IsEnum; }
/// <summary> /// Adds the property. /// </summary> /// <param name="property">The property.</param> public virtual void AddProperty(AbstractPropertyConfiguration property) { if (property != null) { if (_properties.Any(x => x.PropertyInfo.Name == property.PropertyInfo.Name)) { throw new MapperException( "You cannot have duplicate mappings for properties. Property Name: {0} Type: {1}".Formatted( property.PropertyInfo.Name, Type.Name)); } _properties = _properties.Concat(new[] {property}).ToArray(); _propertMappingExpression = CreatePropertyExpression(property); } }