Пример #1
0
        /// <summary>
        ///   Creates the class map.
        /// </summary>
        /// <param name = "classType">Type of the entity.</param>
        /// <returns></returns>
        private ClassMap CreateClassMap(Type classType)
        {
            var classMap = new ClassMap(classType)
            {
                CollectionName     = _profile.GetCollectionName(classType),
                DiscriminatorAlias = _profile.GetDiscriminatorAlias(classType)
            };

            //if(!classType.IsInterface && !classType.IsAbstract)
            //    classMap.Discriminator = _profile.GetDiscriminator(classType);

            classMap.IdMap = CreateIdMap(classType);
            classMap.ExtendedPropertiesMap = CreateExtendedPropertiesMap(classType);

            foreach (var member in _profile.FindMembers(classType))
            {
                if (classMap.HasId && classMap.IdMap.MemberName == member.Name)
                {
                    continue;
                }
                if (classMap.HasExtendedProperties && classMap.ExtendedPropertiesMap.MemberName == member.Name)
                {
                    continue;
                }

                classMap.AddMemberMap(CreateMemberMap(classType, member));
            }

            return(classMap);
        }
 /// <summary>
 ///   Finds the members to map for the class type.
 /// </summary>
 /// <param name = "classType">Type of the entity.</param>
 /// <returns></returns>
 public IEnumerable <MemberInfo> FindMembers(Type classType)
 {
     return(_profile.FindMembers(classType)
            .Where(member => (bool)GetMemberOverrideValue(classType, member, o => !o.Ignore, v => v.HasValue, true)));
 }