示例#1
0
        private void MapVersion <T>(MemberInfoMetadata version, IClassMapper <T> classMapper)
            where T : class
        {
            if (version.IsNull())
            {
                return;
            }

            classMapper
            .Version(
                version.Name,
                m =>
            {
                m.Type(new TimestampType());
                m.Generated(VersionGeneration.Never);
                AccessorHelper.SetAccessor(version, m);
            });
        }
示例#2
0
        private void MapKey <T>(MemberInfoMetadata key, IClassAttributesMapper <T> classMapper)
            where T : class
        {
            object unsavedKeyValue = 0;

            if (key.Type == typeof(Guid))
            {
                unsavedKeyValue = Guid.Empty;
            }

            classMapper.Id(
                key.Name,
                m =>
            {
                AccessorHelper.SetAccessor(key, m);
                m.Generator(GetGenerator(key.Type));
                m.UnsavedValue(unsavedKeyValue);
            });
        }