/// <summary>
        /// 获取程序集容器实例
        /// </summary>
        /// <returns>程序集容器实例</returns>
        public static ORMAssemblyContainer GetInstance()
        {
            if (instance == null)
            {
                lock (instance)
                {
                    if (instance == null)
                    {
                        instance = new ORMAssemblyContainer();
                    }
                }
            }

            return(instance);
        }
        public object MaptoObject(IDataReader reader, DomainModel.Spi.DomainModel model)
        {
            var obj           = ORMAssemblyContainer.GetInstance().CreateInstance(model.RootDomainObject.ClazzReflectType);
            var type          = ORMAssemblyContainer.GetInstance().GetObjectType(model.RootDomainObject.ClazzReflectType);
            var props         = type.GetProperties();
            var resultMapping = resultMappingService.GetResultMapping(model);

            while (reader.Read())
            {
                foreach (var item in resultMapping.MappingItems)
                {
                    switch (item.ItemType)
                    {
                    case ResultMappingItemType.Normal:
                        MappingCommonProperty(reader, obj, props, item);
                        break;

                    case ResultMappingItemType.Enum:
                        var element = model.RootDomainObject.Elements.FirstOrDefault(i => i.PropertyName == item.Property);
                        MappingEnumProperty(reader, obj, props, item, element.PropertyType);
                        break;

                    case ResultMappingItemType.Virtual:
                        var virtualElement = model.RootDomainObject.Elements.FirstOrDefault(i => i.PropertyName == item.Property);
                        MappingVirtualProperty(virtualElement, obj, props, item);
                        break;

                    case ResultMappingItemType.ResultMapping:
                        var asso = model.RootDomainObject.Associations.FirstOrDefault(i => i.PropertyName == item.Property);
                        MappingComplexProperty(reader, obj, props, item, asso);
                        break;

                    default:
                        break;
                    }
                }
            }

            return(obj);
        }
        private void MappingEnumProperty(IDataReader reader, object obj, System.Reflection.PropertyInfo[] props, ResultMappingItem item, string enumTypeInfo)
        {
            try
            {
                var enumType = ORMAssemblyContainer.GetInstance().GetObjectType(enumTypeInfo);
                if (enumType == null)
                {
                    throw new Exception("Cannot find type: " + enumTypeInfo);
                }

                var prop      = props.FirstOrDefault(i => string.Equals(i.Name, item.Property, StringComparison.OrdinalIgnoreCase));
                var enumValue = Enum.Parse(enumType, Convert.ToString(reader[item.Column]));
                prop.SetValue(obj, enumValue);
            }
            catch (Exception e)
            {
                e.Data.Add("PropertyName", item.Property);
                e.Data.Add("ColumnName", item.Column);
                e.Data.Add("EnumTypeInfo", enumTypeInfo);
                throw e;
            }
        }