1 00:00:00,590 --> 00:00:01,300 Hey guys. 2 00:00:01,470 --> 00:00:07,250 So we'll be continuing from setting up the database was setting up or data model in our projects. 3 00:00:07,260 --> 00:00:09,700 So that's our web application. 4 00:00:09,700 --> 00:00:15,950 Laws about the database are just as a reminder that controllers we have models and views. 5 00:00:15,960 --> 00:00:23,250 So the models are the database let's say the mimic files that look like the database structure and they 6 00:00:23,250 --> 00:00:26,480 help us to communicate with the database through entity framework. 7 00:00:27,210 --> 00:00:34,410 So if we look into this folder you'll see that there are a few models because we actually created our 8 00:00:34,410 --> 00:00:40,380 project using the individual accounts authentication option. 9 00:00:40,680 --> 00:00:42,540 If you didn't do that that's fine. 10 00:00:42,540 --> 00:00:47,960 But what we're about to do is add an entity framework diagram to our project. 11 00:00:47,970 --> 00:00:55,370 So we just regulate this folder models we click and we go to new item 12 00:00:58,630 --> 00:01:04,360 then we look for the subcategory that is data that we select our ADA or dot nets. 13 00:01:04,380 --> 00:01:10,930 Entity data model we can give it a name that is suggestive of what we're doing so we can see school 14 00:01:10,930 --> 00:01:15,970 manage rents and I'd like to call mine D.B. 15 00:01:19,840 --> 00:01:21,330 after doing that weekly and 16 00:01:25,110 --> 00:01:29,940 when we get this wizard we want to leave is on the eve designer from database because we're doing our 17 00:01:29,940 --> 00:01:31,880 database first approach. 18 00:01:32,310 --> 00:01:40,920 So we leave that one selected next and then we'll be prompted to connect to instance. 19 00:01:41,040 --> 00:01:49,830 That's our database was created on if you remember you created it on our end as a school logo VB which 20 00:01:49,830 --> 00:01:52,830 means I need to go to the new connection 21 00:01:56,640 --> 00:02:11,320 then put in the server name in this case mine is loco e an S S you o e you could fit this dropdown. 22 00:02:11,370 --> 00:02:13,690 He found more than one instances. 23 00:02:13,980 --> 00:02:19,070 That would probably increase the load time depending on how many senses you have. 24 00:02:19,080 --> 00:02:23,340 And if you're on a network is the search everything so that will actually take a while. 25 00:02:23,370 --> 00:02:26,730 So if you annoyed by half it's easier to just type it in. 26 00:02:26,730 --> 00:02:30,130 And then once you do that you slipped authentication in this case. 27 00:02:30,210 --> 00:02:36,590 Authentication isn't in this authentication and then we select our database from this dropped on this 28 00:02:37,110 --> 00:02:40,470 and our database is school management. 29 00:02:40,530 --> 00:02:44,100 VB then we click Okay. 30 00:02:46,660 --> 00:02:51,180 And then we'll see that the connection the string adjusts a little bit. 31 00:02:51,180 --> 00:02:56,640 And if we look at the Phoenix US string Lucy that is really just English and he gets all of these characters 32 00:02:56,640 --> 00:02:58,750 and symbols those of the way. 33 00:02:58,800 --> 00:03:05,730 It's really just English seeing context on string equals on the data source is our server that we just 34 00:03:05,730 --> 00:03:07,080 typed in. 35 00:03:07,980 --> 00:03:13,680 Our initial catalogue is the database that we selected and then you have some other things integrated 36 00:03:13,680 --> 00:03:17,940 security through multiple active results it's true. 37 00:03:17,970 --> 00:03:21,990 And then the engine behind it is our in 50 framework. 38 00:03:23,490 --> 00:03:30,990 So once we're satisfied with this screen we can just click next then it will ask those swap objects 39 00:03:30,990 --> 00:03:34,400 from our database would we like to improve in our project. 40 00:03:34,650 --> 00:03:42,050 So far we've only created three tables seeking to slip that box or if you have all the objects that 41 00:03:42,050 --> 00:03:48,210 you probably don't want to include you probably want to drill on and select them one by one. 42 00:03:49,220 --> 00:03:50,370 And then we finish 43 00:03:54,980 --> 00:03:59,380 and then this will take a while to load. 44 00:03:59,670 --> 00:04:05,120 Right so once that is completed you be led to a screen that looks similar to this. 45 00:04:05,120 --> 00:04:10,920 You should see course enrolment and students are any team that you have created in that age of these 46 00:04:10,910 --> 00:04:12,090 that you specified. 47 00:04:12,260 --> 00:04:16,380 You'll get this data entity diagram. 48 00:04:16,430 --> 00:04:23,510 So if we drilled on into the files that are associated with our banks our data model diagram we'll see 49 00:04:23,510 --> 00:04:31,100 here that we actually have some CSF some C sharp code files with the same names that correspond here. 50 00:04:31,760 --> 00:04:36,020 And if you were to open those and take a look you'd notice that they're really just class files with 51 00:04:36,020 --> 00:04:43,970 a bunch of attributes and random looking code that was generated. 52 00:04:44,420 --> 00:04:53,270 But then if you pay attention to the properties you'll notice that these properties are directly representing 53 00:04:53,540 --> 00:05:00,530 the fields coming from the database ANSI of course I.T. likely periods of title like we created and 54 00:05:00,530 --> 00:05:08,360 then credits and we made credits knowledgeable in the database so we have a knowledgeable integer property 55 00:05:08,390 --> 00:05:10,880 type right here all right. 56 00:05:11,150 --> 00:05:17,320 And then you see that there is also lending to that list of the related enrolments so way of acquiring 57 00:05:17,330 --> 00:05:20,540 key from enrollments to course. 58 00:05:20,540 --> 00:05:22,800 So entity framework is generating the fund. 59 00:05:22,820 --> 00:05:23,490 That's okay. 60 00:05:23,510 --> 00:05:30,230 There is a foreign fee relationship and I'm going to include a list of the enrollments that this course. 61 00:05:30,290 --> 00:05:33,090 Any particular course would be involved. 62 00:05:33,410 --> 00:05:33,650 All right. 63 00:05:33,650 --> 00:05:41,840 So entity framework is making it much easier for you to manage your relationships and your associations 64 00:05:41,840 --> 00:05:43,030 on the dates of these them. 65 00:05:43,430 --> 00:05:53,030 But more importantly this idea makes the program creates that bridge between our Internet application 66 00:05:53,050 --> 00:05:56,750 or web application and our database. 67 00:05:57,050 --> 00:06:01,800 So that's just how you go about adding the data model to your project.