Пример #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>
 ///   Gets the property name of the discriminator for the class type.
 /// </summary>
 /// <param name = "classType">Type of the entity.</param>
 /// <returns></returns>
 public string GetDiscriminatorAlias(Type classType)
 {
     return(_profile.GetDiscriminatorAlias(classType));
 }