示例#1
0
        protected override void Map(BsonClassMap <Role> map)
        {
            map.SetCollection("Roles");

            map.MapMember(x => x.Enabled)
            .SetIsRequired(true);

            map.MapMember(x => x.Description)
            .SetIsRequired(false);

            map.MapMember(x => x.Name)
            .SetIsRequired(true);

            map.MapListAsRefs(x => x.AccessList, "_authorizations", cm => cm
                              .SetIsRequired(true)
                              .SetElementName("AccessList")
                              );

            map.MapMember(x => x.Private)
            .SetIsRequired(true);
        }
示例#2
0
        protected override void Map(BsonClassMap <User> map)
        {
            map.SetCollection("Users");

            map.MapMember(x => x.PersonUId)
            .SetIsRequired(true);

            map.MapMember(x => x.Name)
            .SetIsRequired(true);

            map.MapMember(x => x.FamilyName)
            .SetIsRequired(false);


            map.MapAsComponent(x => x.Email, cm => cm
                               .SetElementName("Email")
                               .SetIsRequired(true)
                               .MapMember(y => y.Address)
                               );

            map.MapMember(x => x.Address)
            .SetIsRequired(false);
            map.MapMember(x => x.Telephone)
            .SetIsRequired(false);
            map.MapMember(x => x.LastAccess)
            .SetIsRequired(false);
            map.MapMember(x => x.DomainUser)
            .SetIsRequired(false);

            map.MapAsRef(x => x.Creator, cm => cm
                         .SetIsRequired(false));

            map.MapListAsRefs(x => x.Roles, "_roles", cm => cm
                              .SetIsRequired(false)
                              );
        }