public void Map(ClassMappingBase classMap, PropertyInfo property)
        {
            if (property.DeclaringType != classMap.Type || !(classMap is ClassMapping))
                return;

            var version = new VersionMapping
            {
                Name = property.Name,
            };

            version.SetDefaultValue("Type", GetDefaultType(property));
            version.AddDefaultColumn(new ColumnMapping { Name = property.Name });

            if (IsSqlTimestamp(property))
            {
                version.Columns.Each(x =>
                {
                    x.SqlType = "timestamp";
                    x.NotNull = true;
                });
                version.UnsavedValue = null;
            }

            ((ClassMapping)classMap).Version = version;
        }
Exemplo n.º 2
0
        public void Map(ClassMappingBase classMap, Member member)
        {
            if (!(classMap is ClassMapping)) return;

            var version = new VersionMapping
            {
                Name = member.Name,
                ContainingEntityType = classMap.Type,
            };

            version.SetDefaultValue("Type", GetDefaultType(member));
            version.AddDefaultColumn(new ColumnMapping { Name = member.Name });

            if (member.IsProperty && !member.CanWrite)
                version.Access = cfg.GetAccessStrategyForReadOnlyProperty(member).ToString();

            if (IsSqlTimestamp(member))
            {
                version.Columns.Each(x =>
                {
                    x.SqlType = "timestamp";
                    x.NotNull = true;
                });
                version.UnsavedValue = null;
            }

            ((ClassMapping)classMap).Version = version;
        }