Пример #1
0
        private static void CopyAttributeToMapping(ColumnAttribute attribute, IColumnMapping mapping)
        {
            if (attribute == null)
            {
                return;
            }

            if (attribute.IsDbGenerated)
            {
                mapping.DbGenerated();
            }
            if (attribute.IsPrimaryKey)
            {
                mapping.PrimaryKey();
            }
            if (attribute.IsVersion)
            {
                mapping.Version();
            }
            if (!attribute.CanBeNull)
            {
                mapping.NotNull();
            }

            if (!string.IsNullOrEmpty(attribute.DbType))
            {
                mapping.DbType(attribute.DbType);
            }
            if (!string.IsNullOrEmpty(attribute.Name))
            {
                mapping.Named(attribute.Name);
            }
            if (!string.IsNullOrEmpty(attribute.Expression))
            {
                mapping.Expression(attribute.Expression);
            }
            if (!string.IsNullOrEmpty(attribute.Storage))
            {
                mapping.Storage(attribute.Storage);
            }


            mapping.AutoSync(attribute.AutoSync);
            mapping.UpdateCheck(attribute.UpdateCheck);

            //TODO: Discriminator
        }
        private static void CopyAttributeToMapping(ColumnAttribute attribute, IColumnMapping mapping)
        {
            if (attribute == null) return;

            if (attribute.IsDbGenerated) mapping.DbGenerated();
            if (attribute.IsPrimaryKey) mapping.PrimaryKey();
            if (attribute.IsVersion) mapping.Version();
            if (!attribute.CanBeNull) mapping.NotNull();

            if (!string.IsNullOrEmpty(attribute.DbType)) mapping.DbType(attribute.DbType);
            if (!string.IsNullOrEmpty(attribute.Name)) mapping.Named(attribute.Name);
            if (!string.IsNullOrEmpty(attribute.Expression)) mapping.Expression(attribute.Expression);
            if (!string.IsNullOrEmpty(attribute.Storage)) mapping.Storage(attribute.Storage);

            mapping.AutoSync(attribute.AutoSync);
            mapping.UpdateCheck(attribute.UpdateCheck);

            //TODO: Discriminator
        }
Пример #3
0
 public void Should_have_autosync_attribute()
 {
     mapping.AutoSync(AutoSync.OnInsert);
     MappingXml.ShouldHaveAttribute("AutoSync", "OnInsert");
 }