What are T4 templates?( Entity framework T4 interview questions with answers)
T4 (Text template transformation toolkit) is template based code generation engine. So you can go and write C# code in T4 templates ( .tt is the extension) files and those c# codes execute to generate the file as per the written C# logic.
For instance the below T4 c# code:-
Will generate the following C# output:-
So what is the importance of T4 in Entity framework?
T4 files are heart in EF code generation. So the T4 code templates read the EDMX XML file and generate C# behind code. This C# behind code is nothing but your entity and context classes.
If you create a project using VS 2012, you will see the following hierarchy. At the top we have the EDMX file, followed by the TT or T4 file and then the .CS code file.
Below is a great ADO.NET Entity framework interview question video created by www.questpond.com which shows how to do CRUD using Entity framework.