private void OnBeforeMapProperty(IModelInspector modelinspector, PropertyPath member, IPropertyMapper propertycustomizer)
 {
     if(member.LocalMember.Name == "Name")
     {
         propertycustomizer.Unique(true);
     }
 }
示例#2
0
        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 OnBeforeMapProperty(IModelInspector modelinspector, PropertyPath member, IPropertyMapper propertycustomizer)
 {
     if (member.LocalMember.Name == "Name")
     {
         propertycustomizer.Unique(true);
     }
 }
示例#4
0
        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);
            }
        }