/// <summary> /// Carrega as configurações do tipo. /// </summary> /// <param name="culture"></param> private void LoadTypeSettings(System.Globalization.CultureInfo culture) { var entityTypeName = Colosoft.Reflection.TypeName.Get(_entity.GetType()); if (_entitySettings == null) { _entitySettings = _validationManager.LoadSettings(entityTypeName); } string startString = EntityTypeStartString; var allIdentifiers = GetIdentifierSpecialize(entityTypeName, startString, startString, String.Empty); foreach (string identifier in allIdentifiers.Keys) { IPropertySettingsInfo currentPropertSettings = _entitySettings.Where(f => f.Identifier == identifier).FirstOrDefault(); if (currentPropertSettings != null) { IStatebleItem stateble = CreatePropertyStateByIdentifier(allIdentifiers[identifier], identifier, culture); if (stateble != null) { stateble.IsConfigured = true; _propertyAttributes.Add(identifier, stateble); } } else { string[] propertyPath = allIdentifiers[identifier].Split('.'); var currentObjectTypeName = Colosoft.Reflection.TypeName.Get(this.GetType()); bool findPath = true; IEntityPropertyInfo info = null; for (int index = 0; index < propertyPath.Length - 1; index++) { string currentProperty = propertyPath[index]; info = _validationManager.LoadTypeProperty(currentObjectTypeName, currentProperty); if (info == null) { findPath = false; break; } else { currentObjectTypeName = info.PropertyType; } } if ((findPath) && (info != null) && (info.IsInstance)) { IPropertySettingsInfo propertyInfo = _validationManager.LoadSettings(currentObjectTypeName).Where(f => f.Identifier.EndsWith(propertyPath[propertyPath.Length - 1])).FirstOrDefault(); if (propertyInfo != null) { var propertyStateble = CreatePropertyState(allIdentifiers[identifier], propertyInfo, identifier, culture); propertyStateble.IsConfigured = true; _propertyAttributes.Add(identifier, propertyStateble); } else { var propertyState = CreatePropertyState(allIdentifiers[identifier], identifier, culture); _propertyAttributes.Add(identifier, propertyState); } } else { var propertyState = CreatePropertyState(allIdentifiers[identifier], identifier, culture); _propertyAttributes.Add(identifier, propertyState); } } } }