Пример #1
0
        public void WhenExplicitDeclaredThenRecognizePoid()
        {
            var orm = new ObjectRelationalMapper();

            orm.Poid <MyClass>(mc => mc.EMail);
            orm.IsPersistentId(typeof(MyClass).GetProperty("EMail")).Should().Be.True();
        }
Пример #2
0
        /// <summary>
        /// Initializes the mappings.
        /// </summary>
        /// <param name="orm">The orm.</param>
        /// <param name="mapper">The mapper.</param>
        public void InitMappings(ObjectRelationalMapper orm, Mapper mapper)
        {
            // list all the entities we want to map.
            IEnumerable<Type> baseEntities = ListOfModelTypes();

            // we map non Content classes as normal
            orm.TablePerClass(baseEntities);

            orm.Poid<AppSetting>(item => item.Id);

            mapper.Customize<AppSetting>(mapping => mapping.Property(item => item.Value, pm => pm.Length(255)));

            mapper.Customize<User>(mapping =>
            {
                mapping.Property(item => item.Email, pm => pm.Unique(true));
                mapping.Property(item => item.Password, pm => pm.Length(64));
            });
            orm.ExcludeProperty<User>(item => item.IsAuthenticated);
            orm.ExcludeProperty<User>(item => item.AuthenticationType);
        }