What's the use of ORM for database metadata?

I read about ORM and one of the descriptions I read says that ORM interacts with database metadata.

Why is this important or relevant?

Metadata, as I understand it, is just a way of describing what the database contains. So, for example, the database might have an internal table that lists which custom tables were created. Why is something like this useful for ORMs?

+2


source to share


2 answers


ORM uses metadata to generate code used to access tables. For example, if it is a date column, it generates code to process that column as a date.

It will read foreign keys and primary keys to build relationships in your code, as well as generate correct SQL syntax.



These are just a few of the ways metadata can be used.

+3


source


This means the ORM maps the database schema or structure to objects. Typically, this means mapping tables to classes (a user table with the User class), fields for attributes (the Age attribute for the User.Age attribute), and each record then represents an instance of that object.



+3


source







All Articles