HORK and the Database
HORK has a few dependencies on how your database is configured. Since every database is different, HORK uses an XML file as its data model. The XML file can be edited to cover situations where the database is not optimally setup for an ORM appliction.
The HORKTemplateGenerator will expect these properties when scanning for table metadata:
- At least one Primary Key on each table: The PK is used to determine which columns in a table are unique and which can be used as keys. If a table has no defined PK, then any column with unique values can be configured as the PK by editing the HORKOUT.XML model file.
- Child tables are determined by Foreign Keys: When HORK finds a new table to add to the model it checks for any other tables in the database that have foreign keys back to the new table.
Tables with an FK back to the new table are considered Child tables. If no foreign keys are defined in the database, then the table relationships can be configured by editing the HORKOUT.XML model file.
- Some datatypes are not yet supported in HORK: Data types that don't map well to CSharp, or are defined as 'automatic' values are not supported. Currently the unsupported types are
binary, timestamp, rowversion, image, varbinary, and xml.
When the HORKTemplateGenerator encounters a column with an unsupported data type, that column is not included in the entity class. We plan to add support for some of these types in a future release.