private void FinalizeMapReading()
        {
            if (!PrimaryKeyMaps.Any())
            {
                throw new Exception("No primary key maps found on " + typeof(T).Name +
                                    ". Use the AutonumberAttribute or KeyAttribute to mark a property as a primary key.");
            }

            if (StandardMaps.Any())
            {
                AllMaps.AddRange(StandardMaps);
            }
            AllMaps.AddRange(PrimaryKeyMaps);

            if (!AllMaps.Any())
            {
                throw new Exception("No mappable properties found on " + typeof(T).Name);
            }

            AllMapsDictionary = new Dictionary <string, string>();
            foreach (IMap map in AllMaps)
            {
                AllMapsDictionary.Add(map.PropertyName, map.ColumnName);
            }
        }
        private void ProcessMapList(IEnumerable <IMap> maps)
        {
            foreach (IMap map in maps)
            {
                if (map.ColumnName == null)
                {
                    continue;
                }

                if (map is AutonumberMap)
                {
                    if (AutonumberMap != null)
                    {
                        throw new Exception("Multiple autonumber maps cannot be assigned");
                    }
                    if (PrimaryKeyMaps.Any())
                    {
                        throw new Exception("The class already has ID maps assigned. Autonumbers cannot be used eith IDMaps");
                    }
                    AutonumberMap = map as AutonumberMap;
                    PrimaryKeyMaps.Add(map as Map);
                }
                else if (map is IDMap)
                {
                    if (AutonumberMap != null)
                    {
                        throw new Exception("Autonumber map already assigned entities cannot have autonumber and ID maps");
                    }
                    PrimaryKeyMaps.Add(map as Map);
                }
                else
                {
                    StandardMaps.Add(map as Map);
                }
            }
        }
        private void GetColumnMappingUsingReflection()
        {
            Type domainType = typeof(T);

            foreach (PropertyInfo prop in domainType.GetProperties())
            {
                if (prop.IsDefined(typeof(NotMappedAttribute)))
                {
                    continue;
                }
                if (IgnoreObjectMaps && (prop.Name.EndsWith("_Object") || prop.Name.EndsWith("_Objects")))
                {
                    continue;
                }

                if (prop.GetMethod != null && prop.GetMethod.IsPublic &&
                    prop.SetMethod != null && prop.SetMethod.IsPublic)
                {
                    // Column Name
                    string columnName = prop.Name;
                    if (prop.IsDefined(typeof(ColumnAttribute)))
                    {
                        ColumnAttribute colAttribute = (ColumnAttribute)prop.GetCustomAttribute(typeof(ColumnAttribute));
                        if (!string.IsNullOrWhiteSpace(colAttribute.Name))
                        {
                            columnName = colAttribute.Name;
                        }
                    }

                    if (prop.IsDefined(typeof(AutonumberAttribute), true))
                    {
                        // Autonumber Map
                        if (AutonumberMap != null)
                        {
                            throw new Exception("Entity " + domainType.Name + " cannot have more than one autonumber map.");
                        }
                        AutonumberMap = new AutonumberMap(prop.Name, columnName);
                        PrimaryKeyMaps.Add(AutonumberMap);
                    }
                    else if (prop.IsDefined(typeof(KeyAttribute)))
                    {
                        // ID Maps
                        IDMap idMap = new IDMap(prop.Name, columnName);
                        PrimaryKeyMaps.Add(idMap);
                    }
                    else if (prop.IsDefined(typeof(CacheFilemanDateAttribute)))
                    {
                        // Cache Fileman Date
                        CacheFilemanDateMap filemanDateMap = new CacheFilemanDateMap(prop.Name, columnName);
                        StandardMaps.Add(filemanDateMap);
                    }
                    else if (prop.IsDefined(typeof(CacheHorologDateAttribute)))
                    {
                        // Cache Horolog Date
                        CacheHorologDateMap horologDateMap = new CacheHorologDateMap(prop.Name, columnName);
                        StandardMaps.Add(horologDateMap);
                    }
                    else
                    {
                        // Standard Maps
                        StandardMaps.Add(new Map(prop.Name, columnName));
                    }
                }
            }
        }