public void Map(ClassMappingBase classMap, Member property) { if (!(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; }
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; }
VersionMapping IVersionMappingProvider.GetVersionMapping() { var mapping = new VersionMapping(attributes.CloneInner()); mapping.ContainingEntityType = entity; mapping.SetDefaultValue("Name", property.Name); mapping.SetDefaultValue("Type", property.PropertyType == typeof(DateTime) ? new TypeReference("timestamp") : new TypeReference(property.PropertyType)); mapping.AddDefaultColumn(new ColumnMapping(columnAttributes.CloneInner()) { Name = property.Name }); columns.ForEach(column => mapping.AddColumn(new ColumnMapping(columnAttributes.CloneInner()) { Name = column })); return(mapping); }