Hello friends, welcome to the next level in previous lab we have created the DB context class and we registered in services configure services method. Now we have to create the database from our entities for that purpose I give you name, okay. The name is database is equal to student information. Now, if you see here there is a one student info database but no other database okay If I refresh this you can see is only one database. Now well to create one controller for what for testing purpose is our connection is okay is the database is created or not for that purpose I created one controller here class tasting controller and which is inherited from controller. Okay.
So for that purpose, I create one method Jason hunter Okay, and here, I simply return you get some reason. Okay. We, you know, hope is not working here because I need to use extremism for that purpose Okay, we'll see the 200 status code. Now for connection purpose and database creation, I need to create one constructor. And in this in this constructor, we need to pass our context, student DB context object. So for that purpose, I create here one route to the DB context okay?
And I pass object which is created by using service. In previous lecture, we learned that how the dependency injection work, how the inversion concurrent work. So, here I use dependency, okay. You need to use his Tdg In this thing now I have to run this then we will check what happened. Now that our product is around and we see here, there is no database, okay? our database is not created.
So I need to call I need to call this what is your name testing. I use you Testing and if I send a request then we can check you. He's gonna do this come here or not. Okay. All right, why it's not working. Why it is taking so much time Okay.
Now it comes in and after that you can see up till now, there is nothing here if I refresh this and you can see our it's created okay now If I go here and see the table its tables are present in this you can see our entity subject and entity student now, if you want to see you can see entity student okay and there is student and here is ID for ID. Now it says subject table sorry for ID after that name after the mark okay. And if you create or if you use the attribute means required maximum length that will be automatically included here means if you mark as a required attribute, entity class then your field or column in that table becomes not null. Okay? So that's all about table creation automaticall table creation and all that. In next lesson, we will learn the repository pattern and what is the use of that repository pattern.
So for now, thank you for watching, we will meet in the next lecture.