/// <summary> /// Configures the specified property info. /// </summary> /// <param name="propertyInfo">The property info.</param> /// <param name="config">The config.</param> public void Configure(PropertyInfo propertyInfo, SitecoreFieldConfiguration config) { config.FieldName = this.FieldName; if (config.FieldName.IsNullOrEmpty()) { config.FieldName = propertyInfo.Name; } config.Setting = this.Setting; config.CodeFirst = this.CodeFirst; if (FieldId.IsNotNullOrEmpty()) { config.FieldId = new ID(this.FieldId); } config.FieldSource = this.FieldSource; config.FieldTitle = this.FieldTitle; config.FieldType = this.FieldType; config.CustomFieldType = this.CustomFieldType; config.IsShared = this.IsShared; config.IsUnversioned = this.IsUnversioned; config.SectionName = this.SectionName; config.Setting = this.Setting; config.FieldSortOrder = this.FieldSortOrder; config.SectionSortOrder = this.SectionSortOrder; config.ValidationErrorText = this.ValidationErrorText; config.ValidationRegularExpression = this.ValidationRegularExpression; config.IsRequired = this.IsRequired; config.UrlOptions = this.UrlOptions; //code first configuration var fieldFieldValues = propertyInfo.GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>(); ////fix: fieldfieldvalues are not passed var interfaceFromProperty = propertyInfo.DeclaringType.GetInterfaces().FirstOrDefault(inter => inter.GetProperty(propertyInfo.Name) != null); if (interfaceFromProperty != null) { fieldFieldValues = interfaceFromProperty.GetProperty(propertyInfo.Name).GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>();; } var ffvConfigs = fieldFieldValues.Select(x => x.Configure(propertyInfo, config)); config.FieldValueConfigs = ffvConfigs.ToList(); base.Configure(propertyInfo, config); }
/// <summary> /// Configures the specified property info. /// </summary> /// <param name="propertyInfo">The property info.</param> /// <param name="config">The config.</param> public void Configure(PropertyInfo propertyInfo, SitecoreFieldConfiguration config) { config.FieldName = this.FieldName; if (config.FieldName.IsNullOrEmpty()) { config.FieldName = propertyInfo.Name; } config.Setting = this.Setting; config.CodeFirst = this.CodeFirst; if (FieldId.IsNotNullOrEmpty()) { config.FieldId = new ID(this.FieldId); } config.FieldSource = this.FieldSource; config.FieldTitle = this.FieldTitle; config.FieldType = this.FieldType; config.CustomFieldType = this.CustomFieldType; config.IsShared = this.IsShared; config.IsUnversioned = this.IsUnversioned; config.SectionName = this.SectionName; config.Setting = this.Setting; config.FieldSortOrder = this.FieldSortOrder; config.SectionSortOrder = this.SectionSortOrder; config.ValidationErrorText = this.ValidationErrorText; config.ValidationRegularExpression = this.ValidationRegularExpression; config.IsRequired = this.IsRequired; config.UrlOptions = this.UrlOptions; //code first configuration var fieldFieldValues = propertyInfo.GetCustomAttributes(typeof(SitecoreFieldFieldValueAttribute), true).Cast <SitecoreFieldFieldValueAttribute>(); var ffvConfigs = fieldFieldValues.Select(x => x.Configure(propertyInfo, config)); config.FieldValueConfigs = ffvConfigs.ToList(); base.Configure(propertyInfo, config); }