private static void PropertyConvension(IModelInspector modelInspector, PropertyPath propertyPath, IPropertyMapper propertyMapper) { if (modelInspector.IsSet(propertyPath.LocalMember)) { propertyMapper.Access(Accessor.Field); } var type = propertyPath.LocalMember.GetPropertyOrFieldType(); if (!type.IsNullable()) { propertyMapper.NotNullable(true); } var propertyName = propertyPath.LocalMember.Name; if (modelInspector.IsComponent(propertyPath.LocalMember.ReflectedType)) { var entityName = propertyPath.LocalMember.ReflectedType.Name; propertyMapper.Column(IdentityBuilder.BuildColumnName(entityName, propertyName)); } else { propertyMapper.Column(IdentityBuilder.BuildColumnName(propertyName)); } }
void ApplyPropertyConvention(IModelInspector mi, PropertyPath type, IPropertyMapper map) { if (type.PreviousPath != null) { if (mi.IsComponent(((PropertyInfo)type.PreviousPath.LocalMember).PropertyType)) { map.Column(type.PreviousPath.LocalMember.Name + type.LocalMember.Name); } } if (type.LocalMember.GetCustomAttributes(typeof(UniqueAttribute), false).Any()) { map.Unique(true); } var propertyInfo = type.LocalMember as PropertyInfo; if (propertyInfo != null) { if (propertyInfo.PropertyType == typeof(byte[])) { map.Length(Int32.MaxValue); } return; } var fieldInfo = type.LocalMember as FieldInfo; if (fieldInfo != null && fieldInfo.FieldType == typeof(byte[])) { map.Length(Int32.MaxValue); } }
private void ComponentNamingConvention(IModelInspector modelInspector, PropertyPath member, IPropertyMapper map) { var property = member.LocalMember as PropertyInfo; if (modelInspector.IsComponent(property.DeclaringType)) { map.Column(ComponentColumnNaming(member.PreviousPath.LocalMember, member.LocalMember)); } }
public static void ComponentNamingConvention(IModelInspector modelInspector, PropertyPath member, IPropertyMapper map) { var property = member.LocalMember as PropertyInfo; if (modelInspector.IsComponent(property.DeclaringType)) { map.Column(member.PreviousPath.LocalMember.Name + member.LocalMember.Name); } }
/// <summary> /// Indicates if a given property matches a one to one component relationship /// </summary> /// <param name="property">The property</param> /// <param name="modelInspector">An instance of the current model inspector</param> /// <returns>True if the property matches a one to one component relationship, false if not</returns> private bool MatchOneToOneComponent(PropertyPath property, IModelInspector modelInspector) { bool result = false; var one = modelInspector.IsOneToOne(property.LocalMember.DeclaringType); if (modelInspector.IsComponent(property.LocalMember.DeclaringType)) { result = (property.PreviousPath != null) && !property.PreviousPath.LocalMember.GetPropertyOrFieldType().IsGenericCollection(); } return(result); }
private void ApplyPropertyConvention(IModelInspector mi, PropertyPath type, IPropertyMapper map) { if (type.PreviousPath != null) { if (mi.IsComponent(((PropertyInfo)type.PreviousPath.LocalMember).PropertyType)) { map.Column(type.PreviousPath.LocalMember.Name + type.LocalMember.Name); } } if (type.LocalMember.GetCustomAttributes(typeof(UniqueAttribute), false).Any()) { map.Unique(true); } }
void ApplyPropertyConvention(IModelInspector mi, PropertyPath type, IPropertyMapper map) { if (type.PreviousPath != null) { if (mi.IsComponent(((PropertyInfo)type.PreviousPath.LocalMember).PropertyType)) { map.Column(type.PreviousPath.LocalMember.Name + type.LocalMember.Name); } } if (type.LocalMember.DeclaringType != null) { var sagaMetadata = sagaMetaModel.FirstOrDefault(sm => sm.SagaEntityType == type.LocalMember.DeclaringType); if (sagaMetadata != null) { SagaMetadata.CorrelationPropertyMetadata correlationProperty; if (sagaMetadata.TryGetCorrelationProperty(out correlationProperty) && correlationProperty.Name == type.LocalMember.Name) { map.Unique(true); } } } var propertyInfo = type.LocalMember as PropertyInfo; if (propertyInfo != null) { if (propertyInfo.PropertyType == typeof(byte[])) { map.Length(int.MaxValue); } return; } var fieldInfo = type.LocalMember as FieldInfo; if (fieldInfo != null && fieldInfo.FieldType == typeof(byte[])) { map.Length(int.MaxValue); } }
/// <summary> /// Indicates if a given property matches a one to one component relationship /// </summary> /// <param name="property">The property</param> /// <param name="modelInspector">An instance of the current model inspector</param> /// <returns>True if the property matches a one to one component relationship, false if not</returns> private bool MatchOneToOneComponent(PropertyPath property, IModelInspector modelInspector) { bool result = false; if (modelInspector.IsComponent(property.LocalMember.DeclaringType)) { result = (property.PreviousPath != null) && !property.PreviousPath.LocalMember.GetPropertyOrFieldType().IsGenericCollection(); } return result; }
private void TryMapComponent(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { if (modelInspector.IsComponent(member.LocalMember.DeclaringType) && !modelInspector.IsPersistentId(member.PreviousPath.LocalMember)) { propertyCustomizer.Column(member.PreviousPath.LocalMember.Name + "_" + member.LocalMember.Name); } }