Habanero.Smooth.ClassAutoMapper.Map C# (CSharp) Method

Map() public method

Maps the type wrapped by the ReflectionWrappers.TypeWrapper to a ClassDef. NNB: This only maps this Class it will not try to Create or map relationships from related classes. This method is primarily for testing etc normally you would be mapping using the AllClassesAutoMapper
public Map ( ) : IClassDef
return IClassDef
        public IClassDef Map()
        {
            if (MustBeMapped())
            {
                var classDefCol = AllClassesAutoMapper.ClassDefCol;
                var underlyingType = this.TypeWrapper.UnderlyingType;
                if(classDefCol.Contains(underlyingType))
                {
                    return classDefCol[underlyingType];
                }
                this.ClassDef = CreateClassDef();
                MapSuperClassHierarchy();
                MapProperties();

                this.ClassDef.MapIdentity();

                MapManyToOneRelationships();
                MapOneToManyRelationships();
                MapOneToOneRelationships();

                MapUniqueConstraints();

                return this.ClassDef;
            }
            return null;
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Maps the Class of <paramref name="typeWrapper"/> to a ClassDef.
        /// Note_ this will not create the reverse relationships on
        /// the Related Class if they are required. If you require reverse relationships to be set up then please
        /// use the <see cref="AllClassesAutoMapper"/>
        /// </summary>
        /// <param name="typeWrapper"></param>
        /// <returns></returns>
        public static IClassDef MapClass(this TypeWrapper typeWrapper)
        {
            if (typeWrapper.IsNull())
            {
                return(null);
            }
            var autoMapper = new ClassAutoMapper(typeWrapper);

            return(autoMapper.Map());
        }
All Usage Examples Of Habanero.Smooth.ClassAutoMapper::Map