Hey guys.
So we'll be continuing from setting up the database was setting up or data model in our projects.
So that's our web application.
Laws about the database are just as a reminder that controllers we have models and views.
So the models are the database let's say the mimic files that look like the database structure and they
help us to communicate with the database through entity framework.
So if we look into this folder you'll see that there are a few models because we actually created our
project using the individual accounts authentication option.
If you didn't do that that's fine.
But what we're about to do is add an entity framework diagram to our project.
So we just regulate this folder models we click and we go to new item
then we look for the subcategory that is data that we select our ADA or dot nets.
Entity data model we can give it a name that is suggestive of what we're doing so we can see school
manage rents and I'd like to call mine D.B.
after doing that weekly and
when we get this wizard we want to leave is on the eve designer from database because we're doing our
database first approach.
So we leave that one selected next and then we'll be prompted to connect to instance.
That's our database was created on if you remember you created it on our end as a school logo VB which
means I need to go to the new connection
then put in the server name in this case mine is loco e an S S you o e you could fit this dropdown.
He found more than one instances.
That would probably increase the load time depending on how many senses you have.
And if you're on a network is the search everything so that will actually take a while.
So if you annoyed by half it's easier to just type it in.
And then once you do that you slipped authentication in this case.
Authentication isn't in this authentication and then we select our database from this dropped on this
and our database is school management.
VB then we click Okay.
And then we'll see that the connection the string adjusts a little bit.
And if we look at the Phoenix US string Lucy that is really just English and he gets all of these characters
and symbols those of the way.
It's really just English seeing context on string equals on the data source is our server that we just
typed in.
Our initial catalogue is the database that we selected and then you have some other things integrated
security through multiple active results it's true.
And then the engine behind it is our in 50 framework.
So once we're satisfied with this screen we can just click next then it will ask those swap objects
from our database would we like to improve in our project.
So far we've only created three tables seeking to slip that box or if you have all the objects that
you probably don't want to include you probably want to drill on and select them one by one.
And then we finish
and then this will take a while to load.
Right so once that is completed you be led to a screen that looks similar to this.
You should see course enrolment and students are any team that you have created in that age of these
that you specified.
You'll get this data entity diagram.
So if we drilled on into the files that are associated with our banks our data model diagram we'll see
here that we actually have some CSF some C sharp code files with the same names that correspond here.
And if you were to open those and take a look you'd notice that they're really just class files with
a bunch of attributes and random looking code that was generated.
But then if you pay attention to the properties you'll notice that these properties are directly representing
the fields coming from the database ANSI of course I.T. likely periods of title like we created and
then credits and we made credits knowledgeable in the database so we have a knowledgeable integer property
type right here all right.
And then you see that there is also lending to that list of the related enrolments so way of acquiring
key from enrollments to course.
So entity framework is generating the fund.
That's okay.
There is a foreign fee relationship and I'm going to include a list of the enrollments that this course.
Any particular course would be involved.
All right.
So entity framework is making it much easier for you to manage your relationships and your associations
on the dates of these them.
But more importantly this idea makes the program creates that bridge between our Internet application
or web application and our database.
So that's just how you go about adding the data model to your project.