private DaoForeignKeyInfo[] GetForeignKeys(DaoObject daoObject, string tableName)
        {
            PropertyInfo[]           columns = CustomAttributeExtension.GetPropertiesWithAttributeOfType <DaoForeignKeyColumn>(daoObject.GetType());
            List <DaoForeignKeyInfo> retVals = new List <DaoForeignKeyInfo>();

            foreach (PropertyInfo info in columns)
            {
                DaoForeignKeyColumn fk = (DaoForeignKeyColumn)info.GetCustomAttributes(typeof(DaoForeignKeyColumn), true)[0];
                retVals.Add(new DaoForeignKeyInfo(fk, tableName));
            }

            return(retVals.ToArray());
        }
        private string GetIdColumnName(DaoObject daoObject)
        {
            Type type = daoObject.GetType();

            PropertyInfo[] daoIdColumnAttribute = CustomAttributeExtension.GetPropertiesWithAttributeOfType <DaoIdColumn>(type);
            if (daoIdColumnAttribute.Length > 1)
            {
                ExceptionHelper.ThrowInvalidOperation("Multiple column primary keys not supported");
            }
            if (daoIdColumnAttribute.Length == 1)
            {
                return(daoIdColumnAttribute[0].Name);
            }

            return("");
        }
        private Dictionary <PropertyInfo, DaoColumn> GetColumns(DaoObject daoObject)
        {
            PropertyInfo[] columns = CustomAttributeExtension.GetPropertiesWithAttributeOfType <DaoColumn>(daoObject.GetType());
            Dictionary <PropertyInfo, DaoColumn> retVals = new Dictionary <PropertyInfo, DaoColumn>();

            foreach (PropertyInfo info in columns)
            {
                DaoColumn column = (DaoColumn)info.GetCustomAttributes(typeof(DaoColumn), true)[0];
                if (!(column is DaoForeignKeyColumn))
                {
                    retVals.Add(info, column);
                }
            }

            return(retVals);
        }