示例#1
0
        private PropertyMapping GetPropertyMapping(Type type, Member property, ComponentMapping component)
        {
            var mapping = new PropertyMapping
            {
                ContainingEntityType = type,
                Member = property
            };

            var columnName = property.Name;

            if (component != null)
            {
                columnName = expressions.GetComponentColumnPrefix(component.Member) + columnName;
            }

            mapping.AddDefaultColumn(new ColumnMapping {
                Name = columnName
            });

            if (!mapping.IsSpecified("Name"))
            {
                mapping.Name = mapping.Member.Name;
            }

            if (!mapping.IsSpecified("Type"))
            {
                mapping.SetDefaultValue("Type", GetDefaultType(property));
            }

            return(mapping);
        }
        public override string GetComponentColumnPrefix(Member member)
        {
            if (expressions.GetComponentColumnPrefix != null)
            {
                return(expressions.GetComponentColumnPrefix(member));
            }

            return(base.GetComponentColumnPrefix(member));
        }
示例#3
0
        private void SetKey(Member property, ClassMappingBase classMap, ICollectionMapping mapping)
        {
            var columnName = property.DeclaringType.Name + "_Id";

            if (classMap is ComponentMapping)
            {
                columnName = expressions.GetComponentColumnPrefix(((ComponentMapping)classMap).Member) + columnName;
            }

            var key = new KeyMapping();

            key.ContainingEntityType = classMap.Type;
            key.AddDefaultColumn(new ColumnMapping {
                Name = columnName
            });

            mapping.SetDefaultValue(x => x.Key, key);
        }