+ 1

ORM in Java and in .NET.

Wat ORM means and how it is applied in Java and in .Net?

25th Feb 2021, 10:58 AM
Kateryna Bershadska
Kateryna Bershadska - avatar
1 Antwort
+ 1
ORM = Object-relational mapping ORM is a tool that tries to eliminate SQL code from your application's object-oriented code base. The code can be entirely written in your application's main programming language instead of including snippets of SQL all over. The most popular ORM for .net is Entity Framework. NHibernate and many others exist but Entity Framework is the main one promoted by Microsoft. Entity Framework supports a code-first and a database-first approach. Code-first is the most popular and involves defining some classes that get converted to SQL database tables. You also define a DbContext to list out all the tables, provide seed-data and any additional constraints. A lot of SQL's database access is then expressed in an application programming language such as c# and LINQ. For example, you'd access a list of all records in a table indirectly through a container property in your DbContext. You could indirectly insert to a table or tables by adding to the list and calling your DbContext's save() method. Database-first can be useful if your application doesn't control the database schema. This is when SQL schema gets converted to your application's programming language such as c#. Hibernate is popular in Java. I haven't used Hibernate but I think it is similar to the code-first approach with Entity Framework except that an XML file configures a lot of what Entity Framework expresses with its DbContext. I didn't watch it all but this 3 hour video on Hibernate should explain a lot: https://www.youtube.com/watch?v=JR7-EdxDSf0
25th Feb 2021, 9:58 PM
Josh Greig
Josh Greig - avatar