Entity Framework: Getting Started (Complete Beginners Guide) | Artemakis Artemiou | Skillshare

Entity Framework: Getting Started (Complete Beginners Guide)

Artemakis Artemiou, Awarded Database Expert, Trainer,Author.

Entity Framework: Getting Started (Complete Beginners Guide)

Artemakis Artemiou, Awarded Database Expert, Trainer,Author.

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
33 Lessons (3h)
    • 1. Welcome to the Course!

      2:40
    • 2. What is Entity Framework?

      3:11
    • 3. How Does Entity Framework Work?

      2:52
    • 4. What we’ve Learned in this Section

      0:40
    • 5. DbContext and DbSet

      1:53
    • 6. Inheritance

      1:59
    • 7. Code First

      3:44
    • 8. Model First

      1:59
    • 9. Database First

      1:08
    • 10. What we’ve Learned in this Section

      0:49
    • 11. Before Building the Apps: Let's Create a Sample Database

      2:26
    • 12. Build a .NET Console App Using Entity Framework Code First (New DB)

      21:02
    • 13. Build a .NET Console App Using Entity Framework Code First (Existing DB)

      11:50
    • 14. Build a .NET GUI App Using Entity Framework Code First (New DB)

      13:38
    • 15. Build a .NET GUI App Using Entity Framework Code First (Existing DB)

      8:27
    • 16. What we’ve learned in the Code First Demos

      0:53
    • 17. Build a .NET Console App Using Entity Framework with Model First

      17:26
    • 18. Build a .NET GUI App Using Entity Framework with Model First

      11:26
    • 19. What we’ve learned in the Model First Demos

      0:50
    • 20. Build a .NET Console App Using Entity Framework with Database First

      10:44
    • 21. Build a .NET GUI App Using Entity Framework with Database First

      9:43
    • 22. What we’ve learned in the Database First Demos

      0:27
    • 23. About the Entity Framework Core on Linux Section

      1:49
    • 24. Supported Linux Distributions by SQL Server 2017 or later

      0:56
    • 25. How to Install SQL Server 2019 on Ubuntu Linux

      7:34
    • 26. Available SQL Server command-line tools in Linux

      1:06
    • 27. How to Install the SQL Server command-line tools on Ubuntu Linux - Demo

      4:53
    • 28. Azure Data Studio on Linux: A Cross-Platform SQL Server Client Tool

      2:00
    • 29. Access SQL Server on Ubuntu Linux by Using Azure Data Studio - Demo

      9:00
    • 30. Installing .NET Core

      5:44
    • 31. Entity Framework Core Database Providers

      4:27
    • 32. Create an EF Core Project: Code-First with New DB

      12:14
    • 33. What we’ve Learned in this Course

      1:27
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

68

Students

--

Projects

About This Class

In this class, you will learn all about Entity Framework, what it is, how it works, what are its available workflows and their pros and cons.

Then, we will jump into a large set of live demonstrations/guides, that show you step-by-step, how you can efficiently build data applications using Visual Studio with C# and the different workflows of Entity Framework such as: Code First, Model First and Database First.

More analytically, the class consists of the below sections/lectures:

Introduction to the Course

  • Welcome to the Course!

Introduction to Entity Framework

  • What is Entity Framework?
  • How Does Entity Framework Work?
  • What we’ve Learned in this Section

Entity Framework Concepts and Workflows

  • DbContext and DbSet
  • Inheritance
  • Code First
  • Model First
  • Database First
  • What we’ve Learned in this Section

Live Demonstrations - Let’s Build some Apps!

  • Before Building the Apps: Let's Create a Sample Database
  • Build a .NET Console App Using Entity Framework Code First (New DB)
  • Build a .NET Console App Using Entity Framework Code First (Existing DB)
  • Build a .NET Windows Forms App Using Entity Framework Code First (New DB)
  • Build a .NET Windows Forms App Using Entity Framework Code First (Existing DB)
  • What we’ve learned in the Code First Demos
  • Build a .NET Console App Using Entity Framework with Model First
  • Build a .NET Windows Forms App Using Entity Framework with Model First
  • What we’ve learned in the Model First Demos
  • Build a .NET Console App Using Entity Framework with Database First
  • Build a .NET Windows Forms App Using Entity Framework with Database First
  • What we’ve learned in the Database First Demos

Wrap-Up

  • What we’ve Learned in this Course

Meet Your Teacher

Teacher Profile Image

Artemakis Artemiou

Awarded Database Expert, Trainer,Author.

Teacher

Hi there! I'm Artemakis. I'm a Senior SQL Server and Software Architect, a professional Author and Speaker, and a former Microsoft Data Platform MVP (2009-2018). I have over 15 years of experience in the IT industry in various roles and I'm also a certified SQL Server Engineer.

Moreover, I'm the founder of SQLNetHub and TechHowTos. I'm the creator of the well-known software tools Snippets Generator, DBA Security Advisor and In-Memory OLTP Simulator. I'm also an author of many eBooks on SQL Server.

I currently serve as the President of the Cyprus .NET User Group (CDNUG) and the International .NET Association Country Leader for Cyprus (INETA).

I'm here at Skillshare, to share my expertise with you, in a simple and understandable way. My classes include ... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Welcome to the Course!: Hello and welcome to the only course Anti framework getting started. My name's has stomach system. You and I will be your instructor for this course. A few words about me. I'm a scene of super sevens off the architect. I'm certified Super seven professional I have seen in Microtel a platform M v P. For nine years. I have over 15 years of experience with Seaworld Server and .net Development on a professional book, Inactive a loss. Or, for example, I read after calls for a medical teams that calm, simple talk quoting side SQL shock and more on the founder of SQL Net Cap and Tech. How truth did call. I'm the president of Cyprus Internet User Group and their net our country that for Cyprus who did attend these cars, this course should be attended by people that developed applications in the Internet and want to be more productive by people that want to start using that. The framework for building robust that net their applications by dot net software developers that want to just four push on beating the software and not the database. And it's always by technology enthusiasts that want to learn more about so for development into the net. What we really are in this course. First of all, we will learn what's entity, framework hound US anti friend would work there will jump right into the different concepts and work flows off entry from work. Who will talk about difficult text to be said, Inheritance innately framework and about its work flows that this coat first mother first and delivers first. Also, we will see many live demonstrations, which are actually full guides on how you can build different applications using anti framework. And it's worked close. After the course, you will know how, until frameworks you will be able to create a Net console and Windows forms. There is going that applications using any off the available and a friend were flows. Also, you would be able to design the Net and their applications much faster and will be far more productive now about the course requirements. It's good to have some basic programming principles and, more specifically, C sharp programming language knowledge, Microsoft Visual Studio. It's good to know, because we will develop our applications using Microsoft Visual Studio and now that in this court will be working with dot net framework on Windows and NT Framework six via Microsoft be just with your 2017 great let's begin. 2. What is Entity Framework?: the first thing that comes in my wife has here apartment you family is, of course, what is anti framework. The purpose of this lecture is to help you better understand what exactly anti friend were is and how you can benefit from using it. Anti Framework was first released in 2008. It is an object relational My prayer that this O. R M two it is nowadays. Open source. It allows you toe where with the bases using the Net object. It allows a developer who ride the lesson data access code and much faster. And and data access is performed using the model that is a netted in data model. Ah, that consists off entity classes and derived context. Based on the database. There are several ways of creating the modern. For example, you can generate the it to India, the motel from an existing database. Or you can create from scratch in order to march in the database or even creating noon database. So you can either visually designed the motel or specify they get so many classes with cold and then generate than that are based on based on these modern in anti family you can create a day that using the language in Tikrit a query that is the powerful link and the available versions and additions currently are anti framework seeks an anti framework court You can learn more about at the framework using their below league. The first vaginal NT framework was first released in 2008. It's part off no tenant Farmer 3.5 SPR and Visual Studio 2008 is pure. Several years later, we have anti friend with fashion seeks. We should answer under the Net framework four or later, and Iran's only on Windows anti fragment core is a lot with extensible and crossed paths. When Vegeta off every framework, it was first released in 2016. It is cross platform, so he can around on the Internet car, which supports Windows Lennox and Michel West and at night family on Windows. It offers a new features and would be added unity from exceeds but still lack some features and three formal six hus. You can check a comparison matrix for anti family court and anti family seeks using the below league if the benefits of anti family are many. First of all, There is one common syntax for all option queries that is, link. It is very easy to implement creator it update and delete operations. It uses a development time and cost. It also generates called it allows you to visual design data models and mapping is today the basis, and it is a fast underpass way on development aid applications. In the next election, we are going to talk about how does NT framework? 3. How Does Entity Framework Work?: read. How doesn t Framework Helm doesn't make it possible for the developer to just focus on writing the code and anti from work, taking care off the dangerous part in this lecture, or we'll learn all about it. The purpose Off Entity framework is to allow application developers Toby able toe wear with data in the form of entities without having to concern themselves about the other lying dead every subjects these allows a developer toward at a higher level of obstruction. It allows developers to maintain their applications with less coat, and in the end, it allows the developer to focus on the application logic instead off data map ings and changes. NTT Data Model is a core part off anti framework. It is a set of concepts that are used to describe all meta data and structures off data the Catholic off its start form, the basic components affinities and did the mother are the conceptual model that is enough struck specification for all entities. The storage model that is the logical model off data based on the data source that is the underlying database and mapping, which contains information off how the conceptual model his mouth to the storage model, for example, how entity and deliveries object associations are formed and maintain. Let's take a look inside intended. So we have the entity in their mother scheme of the storage model, which has a connection to the relational database and the mapping model, which has associations between the entity in data model schema and the storage model. Now let's talk a bit. About 90 framework were close has measured that in the beginning off this course at your framework supports three types over off work flows. The first were closed. The court first workflow and has to subcategory, have these court fast with new database and cold. First with existing data, please the court first workflow you specified entity into the motel via creating domain classes. Then we have the model 1st 1 flow basement with you visual designed, intimate there the model and then the races, automatic holly generated and the last but not least, that there are ways First model, which allows you to create their teeth into the model based on an existing database. The decision about which were flute used is purely yours. It depends on how you like and feel comfortable toe developed other ups. We'll talk about more about this in the next section 4. What we’ve Learned in this Section: Now let's review what we have learned in this section. Which one introduction to anti framework We learned toward East anti from work way. So creating the data model, available versions and petitions. What is it you from work seeks and he framework or and the benefits from the framework we discussed How thus anti from book work show we talked about until their model basic components. 20. In the model we show insight off, Anteon did a model. How it is structured, how it works, and we talked about the anti framework work clothes. 5. DbContext and DbSet: in this election, we're going to talk about the context, and the B said these two classes are major components off anti framework. Debbie Context is the primary class in the every framework that interacts with the database . On instance of debate context is actually a session that database the context makes it possible to perform the blow actions allows. Writing Mexican queries materializing query results as anti the objects tracking changes that are made toe those objects persist. Object changes back on to the base bind objects in memory to you I controls and more. The most important method in the DB context class is a safe changes method. These method allows pushing backed within database any changes performed via the entities. You can learn more about the context by following the below league. Now did, he said, represents an entity that can be used for, create, read, update and delete operations. Deposit classes are other doesn't properties to the derived in context class. You then work there to be said entities using methods. Examples consist of the below at that method. Alternatively to their collection, Martus added. They remove method that removes on MTV find, which finds an entity in the collection single that reprieves a single instance off. An entity to least that retrieves multiple instances off an entity and much more. By following the billowing, you can get the full list off supported methods in a deep state class, the next election is about inheritance in a two framework. 6. Inheritance: in this lecture, we're going to talk about inheritance unity framework. You not to understand, Harry doesn t frame were first. We need to understand in general inheritance programming. Inheritors of programming is when new objects are based on other existing objects and then get that is, inherit the same properties. So one example ease the vehicle class because the method start and stop. And that's a cute colored Kate and Valya inheritance. We have to new classes. That is the car class that inherits the same methods and attributes like it's part of that is a vehicle class and a motorcycle class that also inherits the same methods and attitudes . But you can see that we have added another article in this class that is the number of Cui's. So this way you can have pardoned classes and child classes now regret inheritance in every framework. There are three types of inheritance that is a table parent hierarchy headlines that these two pH where a single table is used to store the data for all times in the hierarchy, and it is the different pattern in a two framework inheritance. Then we have the table prototype deputy inheritance, where there's a separate table per domain class and table per concrete type. That's TPC, where we use one table for each known obstruct class currently in anti from our core Onley , T. PH is prevented. That is table parent higher heat. You can learn more about hair density framework by following the billowing. In the next lecture, we're going to talk about the coat first, workflow into framework. 7. Code First: in this lecture working to talk about the court. First, we're flow in a T framework. What's called first court first is a were prominently friend work, which was first introduced in 80 Framework 4.1. It follows the domain driven design protect, and the main idea is that you create in domain classes based on which of the base can be created in the back out. Cold friends can be used with immune to the base and also with an existing database. So that is two sub wear clothes where you were going to see more detail next. Now, like after court first willingly database, you need we just with the 2010 or later that the idea is that you talking that the levees that doesn't exist or an empty database at court first either create database or adds new tables. 2018 database. We could first you define your mother using C shop, or VV doesn't have classes, and you don't really care about it that I was part because it is being taken care by every framework. The men were flow. It's the below you creating union application. You defined the model who's in classes, you create a context. You then read, write data and handled any model changes. You can learn more about the court first with the new database by falling the below league now about court first with an existing database, you need Visual Studio 2012 or later. You do then tack it on existing the base and anti framework tools for visual studio allowed to generate initial code to map to the existing database. That is, you create your data model with code first from database. The mess workflow is the below you're creating union application. Who creating data model from the database that is code first from the base. Then there is derived context that uses DB set the necessary model classes are automatically created, then jewelry tried on data and handle any model changes. By following the blowing, you can learn more about the cold. Fares will flow with an existing database. Now we're having a part of court. First, it allows faster development. Just start coding without worrying about the database. It is so much cleaner code because it has a limited of the united cold. The majority of the Cody's accredited by you, the developer. It allows you more control over her classes. It is simply because we just maintaining the rain classes, then the basis of quality created. And it is a more efficient that are a special controlled Mikel's now about the cons off court. First, it is difficult to customers that is mapping for an existing database. In the case of many tables, we need to create a large number, often domain models, that is, classes. It is a little bit complex to create other database objects besides tables, for example, creating store procedures, functions that set her. And if that that is directly modified, changes will not be automatically reflect in the applications entities because it is a code that defines that the pace and not vice versa. So in case where the divisions directly modified, you will need to be very careful with handling any changes. In the next lecture, we will talk about the mother. First, we're flow into framework 8. Model First: in this lecture will talk about the motor first workflow in anti framework Mother First is another were flowing into the framework for using. You need to use Visual Studio 2010 or later. The minute is that you visually creative designer model and then general and jittery schema from the motor. The basic wolf Where Flo is the following you creating new nicknamed application You create a model using the entity framework designer Gin generated database. You perform, read and write operations, and last but not least, you handle any model changes you can learn more about. Modern fest will flow by following the below lead Now about the process model fest. It provides the flexibility toe delay, the creation of into the base. You can't visual design the structure, outshone it and then generate the database. And if you are designer oriented, then this is closer to your style of development. Also, whenever the database changes, the modern would be after the Courteney. The costs of Mother First are that even though you visual designed the modern, the actual Cody's auto generated and this means that you don't have full control. Also, there is a risk for data loss in case you change your model and push these changes on the death of is level. So in such cases, you need to manually controlled them. Also, there is, um, power package called entity Designer that every generation power park it supports Visual Studio 2010 on you can check it out in the V just with your marketplace. In the next lecture we're going to talk about the data is first quarter flow. 9. Database First: Now let's talk about the diaries. First database first is another entity framework where flow it is the third and final part of clothes off into the framework. For our guides, you need to use Visual Studio 2010 or later on the main. It is, as you create a model by reverse in January on existing Della based There may workflow off . Database fast is that you create a noon that net application. You generate the motor from into that place, and then you eat right data and handle any database changes. You can learn more about it by following them blowing. Now. The process often of his first, is that if you haven't existing ready for use database, then you'll save time from creating a new one. Also, there is a limited that a loss risk because any change or update will be first taking place on the database. The cutting the cords off the baby's first. If you have a large database, this also means that you'll get a large and difficult to maintain modern 10. What we’ve Learned in this Section: now let's review will have learned in this section. So we learn. What is the DB context class? What the D. B said class is we learned about inheritance, unity framework and about its wealth flows. So we learn about the cold fest workflow. What is exactly called first Court? First thing Monday, the base coat first with an existing database and its process and course. Also, we learned about the mother fastball flow. Eso we know know what it is exactly, and also we know it's a person costs. Last but not least, we learned about the database first, workflow its definition as well as its process and constant. 11. Before Building the Apps: Let's Create a Sample Database: Now I have some good news for you. I will have just completed the theory part off anti framework, and we are ready to proceed with the more interesting part, which is the full guides. That is a serious off, like the most off life demonstrations for creating different cool stuff using anti framework. So this is a section full kites and let's build some ups, um, before proceeding with the demos we need and database to work with. So let's create a sample to the base for our demos we needed the basis said earlier. And these database is called sample to be underscore E F, which E. F stands for anti framework. I created these Did I raise for this course and Cassie's off three initial tables, their first tables customers, the other owners orders, and the 3rd 1 is addresses. These tables are related between them with foreign key cross straits. Also, I have populated these three tables with some sample data. In order to be ableto run queries, get the results, modify records via our live demonstrations. Right after these elections, you can download in Document, which contains the necessary T sequel DDS and the M l screams for generating these initial sample database. Ah, justice a note. It is always recommended. Toe ran any tests on non production environments. So if you don't have a test environment of super Sever, you can download a free version of Super Saver, such as sucrose ever express or develop politician and use it on a test environment in order to on deploy these sample data base in order to be April 2 and for being able to work with it using anti framework. Okay, let's jump to our first the diet that these demo How to build in the Net console application using the anti framework with coat first new database. 12. Build a .NET Console App Using Entity Framework Code First (New DB): so welcome to our first demo. It is there more going to build on the Net console application using the entity framework with cold Fast noon database. So in the demo, we're creating your contract education, the Internet using C Sharp who will create the model classes in context. We will modify the connection String will generate invertebrates from our model. We will read and write in data, save the changes and handled the model changes. OK, since this is the first guide in this course, let's take a look at our initial database. That is the sample DP underscored years. As measured earlier, These sample database has three tables, others his customers, the daughters. Let's see diagram with the relationships between these tables. So we have the customer's table, which is related to the orders table, because when the orders table there is Frankie called Customer I D, which points toe the I d. Call him the customer's table. And also there is. There is another foreign key in the customer's table who is called Atrocity, which points to theatrics is table okay, Let's jump right into Visual Studio 2017 and start building our first anti framework application. So we go to file new project and we choose to create a council up. Let's name these application E f underscore Coat first underscore constantly. Now we have an empty, questionable application. Project Visual studio. In the next step is twat on anti in data model. So we're I've played on our project and we go twat, you liked him. Then we choose the data category and we select the radio to Internet at student Data model down the name I will just right here in deep immortal. So this is the empty and their mother. Who is that? And since we are using quote first for these guide, we select empty coat first model. As you can see, there is another option. Quote first from database, which is this allows you to use an existing database. We're going to see these in the next day. Most. But now for this demo, we will create m delamater from scratch using pure coat. Okay. With 11 empty called first modern would click on finish. Excellent. This is a deep motor class. So it's from this class that we will define our entities. So let's not common these and let's create two new tables. Let's name the first if cuss and the other one okay, if actress I specify their fields. So this way I have specified to classes which eventually they will create the corresponding to tables in the database. I need to specify, um, their corresponding DP sets and the only thing that has now left is to create an association between these two. So I will care the association by using them to be set. You have had this. Moreover, I need to add a new name space. That is the data on notations in order to specify my keys. So I go to they have cast class and specify the I. D is the key for this class and similarly, in the ear factories class, I specify that their deep is the key. Okay, let's build our solution. An important note is that amusingly just to go 2017 it and I don't need to manually include anti framework in my project. But in case you're using an older version off visual studio, in order to be able to use anti framework, you need to add it in your project. Togolese, you go to tools and you get package manager, then manage and you get a package for this for solution. You can see that anti framework instant store for my solution, but in the case it is not. He stalled. You can browse or search in order to find it and install it for your project. Okay, so now we have built our solution and we go toe the program class in orderto right. Some country coat. Let's write a query that the reads one of these tables. - Now we'll specify our query that it's a link query. And now let's right the court that displays the results off. He's quitting. No, of the who are using forage in order to inaugurate the items in the queries results. - Okay , let's repeat our solution. So I now have created our that our model by specifying the two entities studies have cars and the arteries. We specified the corresponding DB sets with. If CASS pointed toe if customers and the mattress two year, if after says we have specified an association between if Carson if address where there is reference from customer to if actress and we have ah written basic hold for retrieving customer information, from the relevant table now, before running the project. That is another important thing we must do. Even you open the app Graphic XML below. We can find the connection String anti framework coat Fast buying default includes a connection string to local DB If you need to change this connection string for using code first against another sequel server instance that you have You can do it from here. For example, I'm using on dedicated test She was, sir very instance for these demos their name of a stunt. Cease um de fpc colon backslash c quit Took a 17 days. So I'm going to define these instance name in my connection string. Moreover, you can control the name of the database that will be created. So this is the initial cattle co value. The name off these and their base by default ease thinks one. But I'm going to modify the beat. So my noon delivering would be named e f underscore. Quote fares underscore concert. Okay, we save we rebuilt and let's go from the console to the proper directory. In order to run these example, I'm clubbing a path and this is execute upper if undergrowth quote first underscored council all except to before running Mexico. Double check if there is, and the race from the server when she was ever so still, the database is not created in order for the Dell appears to be created. We need to, uh, around the application. Okay, Our application. Successful Iran. It did not display any results and because there are no records in the tables. But now let's check you than the other place was created so he'd refresh, and we can see that our court first database has been successfully created. So let's open it. Let's check the tables. You can see we have the f, others is stable and the even if cast. Now let's create and diarrhea to see if there is a relationship between these two tables. And yes, there is relation between the two tables because we have specified in the customer table that there is a foreign key pointing to here for actresses. So these confirms that our database has been successfully created based on our model classes. Now, uh, let's insert some data in the directly into the base and the let's around again. Our application in order to see if it successfully retrieves data from the database. - Okay , let's run again. Our obligation to see if it is there. Definitely the race. And as you can see now, application connected to the database that was created earlier and retrieved, successfully retrieved and data. Okay, The next step is toward some and data in the tables via our application. So let's see how we can do that will go to the proper class. And we continue to add some coat. Okay. So creating the instance of new off the F CASS class we specify the 19 name. We did not specify an address because it is not, um necessary. And we added these new instance in our if customers and to be set, and we ran again. And the Queary noted to double check that, and data has been successfully inserted. So we rebuilt the solution and ran it again. So eventual. Now we will see 1/4 record for our customer table. We click and a key in order 12 the record and we can see that the record was not at it. How come the reason for the records not being added is that we forgot who include the most important method call for our data modern. That is the safe changes method. So after adding new customer, we need toe at these common save changes, we repeat and lets it on again our program. Excellent. Now you can see that 1/4 or a court has been added to our database. So we double check by going to see what's ever around again, a query on the of course table in order to see that the force that I quote has been successfully inserted. So now if we want to change something in our model, we can go again to the deep, immortal class. And, for example, let's say we want what a newme Um column In a worry of cast table, we just go here. Let's name this column remarks. So the next step, now that we have added the column in a table in the anti we need to Michael exchanges twin deliveries It also to Michael the changes to the database we need to run migrations. So the way to do this, you in the court fast workflow is to go to Tools Boat, who indicate package manager it has common is to enable the migrations. So we ran the command in April. Migrations. Okay, that was successful. We adding new my creation. And we give a name for our migration. That is, that's a mortal changes one. Okay, And now we update our database. So the migration was applied. And let's double check by accessing the deliveries from server management with you. So we refresh the entity they have. Cast table. Let's check. Now it's college, and you can see that their remarks Colin has been successfully migrated on our database value and to framework. Great. Now let's jump to our next demo. In the next demo, we're going to build in the Net concert application using them three framework with a court first existing database this time. 13. Build a .NET Console App Using Entity Framework Code First (Existing DB): sure. Welcome to these noonday Emma. We're going to build in the Internet Consul application, using their family with cold. First existing to the base. So in this demo will create a new contract vacation Internet Using C Sharp. Will we create a data model from database that is called first from database Will read and write and data save the changes and handle model changes as well. So we are back in our test environment and starting new Visual Studio 2017 project again. We will start a parcel up project and we will name it if court first concert existing. Maybe. Now again, we need to add a new data model. So go toe right click on the project. Go toward new I, Tim, and in the data category will select 80 old Internet and to India, the mother again. We said its name to leave the water. We click on that and now this time we will select quote first from database. So I was would be setting having new deliveries connection here, and I would be using the sample database created for this course that this sample db underscore here test connection all good way proceed, and now we need to select the tables to be included in our data model. I will be selecting tables at recess, customers and daughters Cleveland finish. And now the mother classes are being generated automatically, so you can see that now. My product contains three classes that is theatrics, class, customer class and order class. The's check their cold is similar to the previous name where we created our data mother from scratch. So again there tended annotations are used and for each anterior is respective ah, class with the fields references toe the other classes, for example, the order class references, the customer class and so on. Now let's add some cold. No need to change application configuration fight this time because since our mother was generated from an existing database, therefore we had to establish a connection to the database. These information is being reflected in the up conflict file as well. So that's why was he here that our data sources deaf PC or one backsplashes Kurt took a 17 days and the initial catalogue a sample db underscore here. Okay, lets at some quote, retrieve data. It is the same way like before, even again, let's 30 information for customers and via enumeration. We can display this information. - We could add more columns, but with just true columns. It's enoughto understand the whole process. Okay, let's beat our solution And let's let's hope in command prompt in order to round execute double so we could be the puff and let's around the problem and then you can see it. Our program success well connected to the database and retrieved data. Now let's at a new record, just like we did in their previous demo and see if it was successfully added to the devotees. - I want said an idea because he's an identity column increased by one each time. So I will just set first name, last name and after city. Uh huh. Okay, Now we at these instance to our did that piece. So we reference customers and with the at command, we are the new cuss. Remember previews when we talked about the fury of any friend where and more specifically for the context and DB set classes, One of the methods in the debates had class was that method. When we reference the at method here, it is exactly the art method of the TV set class. So last step is toe save changes, and we will narrative again and data in order to confirm that our new record has been successfully incentive into the database. Let's beat and ironic in our application. So this is the first set of data before adding the uric court, and now we have added 1/4 the record. And, as you can see, it has been Retief former database as well. Let's and double chip by visiting our server. Instance Valya seven Management Studio and running a query again on the customer's table. And as you can see, this is a new record we instructed via our application using and three framework. Now what about it? One toe adding new columns in one of the tables. So let's say we want toe. Add a new column in the customer's table and name it remarks to prior to doing anything because this is called first common existing database. We need to follow a certain procedure. The procedure is the following First we enabled my creations. You have the package Manager Constant. We are on initial my creation. Okay. With the flag ignored changes, We acted the database and now the time to us the new cold. So we called customer and out here the quantum rebounds to we repealed and at another migration. Okay, is the new my collection code? As you can see, it contains the remarks two column and always left Now distracted the database with the update touched their that phase command. Now lister fresh there customer's table. And as you can see the remarks, two column has been successfully added via, uh, quote my creations procedure. Okay, we have successfully completed this them as well, so we are ready to jump to our next demo. That is how Toby Little Net Ongoing application using the anti framework with Coat first new database. 14. Build a .NET GUI App Using Entity Framework Code First (New DB): we continue our in testing their most with another demo. That is how to build and detonate ongoing application using the entity framework with Court First Noon database. In this demo, we're creating new Windows forms. We application Internet Using C sharp, we will create a mother classes and context from these will generate and database from our modern. We will read in the right data, save changes and handle mortal changes back in our test environment. We starting new project in Visual Studio 2017 and this time we're going to build a windows forms up. Let's name the project if coat first, we know DP and the next step is to out again on 18 delamater. Actually, it is always, um, the same process regarding the data model. I mean, you start either a console application project or winter forms agree project in visual studio and then your ad click on the project Goat. What new item? And in the data category, you select what a new 80 odor to 17 and did a model item. And let's name it, I can db multi. And the next step is to select the workflow. So from here, you Can Jerry database that is a database first. Workflow. You can create an empty anti framework designer motor that is the motor first workflow, and the other two were flows are the code. First, we're close, either with a new the race or un existing to the base. Visibly application using coat first with immune database show was select this workflow empty coat first model. Okay. Similarly, like before we will create this time. Let's just create a single anti for the sake off a simplicity. So let's name it. You have to Customer said. They d be said You have to customers. Now let's hit over up the config file and said again the connection string. So this is my secret surveillance Does name and let's name the database you have called first going new to be. Let's repeat our solution and now the court part even go to data sources. We adding new data source. Now what father and we select object hit next. And from here we can select our entity, the center. He represents the table that will be created in the database. No, that by now we keep on working with data access writing code and still we don't have another base. This is the benefit of court. First, you just work with built in your application without even having and database. After we will finish our did they raise will be automatically creative based on the model class. Okay. No, we will at these data source on our form s a direct view. Excellent. Okay. The next step is to enable the save matter at another battle for a fresh and it's time. Twat, twat. Our 100 quote. It's said the text for our bad turn fresh. Okay, No, let's hit if seven in order to open the coated it or and at some country quote. So in the formal out event, we will create a new instance off our data Modern. We will prepare on data by creating at least off our customer's table. And we were going to set the date and binding for our data critical. Okay, with this cold, whenever we were on our project, it will be connecting to the database with specified in the up conflict file and retrieve data from this table by displaying on the data grid view. Let's sit down and check off course. This first time it wondered even and day that because that is known database. So the first step that entry forever will do is to create the database. Okay, the program around successfully. But as you can see, we have known data. Okay, let's stop the bagging. Ah, check if the database what success will create it? Let's double check. Actually, let's refresh than that, at least in our civil server instance. And as you can see and they basically have coat first, gooey nudity has been successful. Created with the table you have to customer just like we set up using the model class. Let's at some data from here, Cash one and let's around again our application accident because he the other applications successfully retrieved the record. We instead that values he was having management studio in our table. Okay, let's proceed with the rest off their project and at some 100 code for the fresh battle and they save button. Now we're getting the refresh button yet stomach you in the battle, and here we can have the 100 cold, which is actually a fresh call for our greet. You like review. Okay. And with double kicks on the save button twat having cold, which is nothing more than a single line of code that is DB safe changes. That is the much method off anti family that's repute. And this time, let's at a new record in our table via our application. Let's around. Okay, cool hint. Let's that cost, too and cost. Three. Don't set an idea because it said toe identity instead. Okay, lets a fresh A Z you can see it was successful. So we have two new records in the database. Let's double check By visiting, she was ever imagine it's with you. That's right. Click on the table, Select top 1000 rows. And as you can see, data has been successfully insisted. Okay, we exit application. Let's check their design off the table. This is the columns. No, let's confirm a model change. So again we go to a TV mortal and we adhere is something I intentionally missed toe at the beginning on this demo. So we'll add it now as a model change so amounting that annotations name space. I'm sitting on the's s key. Also, let's at another column name it remarks. No, that's her built and let's push our model changes back to the dead Amis. So we'll go to tools and you get package manager, package manager console and let's enable my creations for these products. Let's adding new my creation. Name it Model changes. Three. Let's update our therapies. Now let's check the database from Super Several modernised with you. And as you can see, the new column has been at it. So this is how we manage model changes and pushed these changes back to the database. Also, let's select again her coach. I can see that third columns listed with novel Now what about if you want what this column in our data cred you as well not to do this. We go to our form and Eddie to the directory of you columns. We click on that column, and we can see in the data about calm released that ReMax is also available. So we had it. So we're on our program. We rebuilt and run program again, and now let's at some remarks by modifying the existing their coach save our changes. We hit back to see what's ever management studio to double check ive This if our records has bean been successfully modified. So right, click Select Khobar. 1000 rows and you can see that their course indeed. We're up to it. Okay, excellent. Let's move to the next demo. So the next demo, we're going to see how we can build and the Internet gui application using the entity framework of court first existing database. 15. Build a .NET GUI App Using Entity Framework Code First (Existing DB): So we conclude our court fast in their mouth by building and the Internet going application using the entity framework called has existing database. So in this them we're creating new windows forms. We application in the Net using C shop Created a data model from the base that is called fast from the base Retried. Some data say the changes and handle model changes. So fuck in our test environment, we start in new visual studio project. We select Windows forms up and we name it he f quote first, gooey existing to me first step is twat. I do nt into the modern. So we rescue on the product Select at White Tim and from the daily category. We at the 80 Odor Connect and didn't data model. We name Allah Rupture dp Morton. And we said, like the workflow coat fares from database who have a connection stating from before, if you don't have the connection string, you clearly knew connection and you said the connection string to our existing. There's a vase now that the Connection String said things are saved with the name D B. Martin and I would just at the customer's table. You can see that the customer class has been created representing the entity that is the table in existing database. So prior to go to the U. S. Forces in that it s a direct radio on my form. I need to build my solution or rebuilt in order for the changes to take place. That got did a modern. So now I go to data sources and I add and their source from object. And here you can select my name space. And from here I can salute the entity customer people finish and I can I track and drop these s and adequate few on my farm. Okay. I enabled the save butter and are the refresh button as well. Okay. Turned toward some funding coach. So we hit F seven and seems like before way we create on instance off the DP model class in the form local we install. She ate the object. Okay the least. And we said the biting sources also we at 100 called for the safe pattern. That is a command saved the method method called save changes. And for the fish pattern. Yes, I can quarto. Very fragile. They like review Okay, we rebuilt. Let's run our project. So these are a hooker. And let's modify a record and see if changes are saved. That's keeping safe. Let's double check. The change took place by checking a table by. This is a mess, so go to sample in the BLS. Cory, if we called tables customers, it's either records and you can see that the change was successful. Okay, now let's. But from the last step in these in demo that is changing their data model and pushing the changes back to the database she is. This is the court first workflow when using existing databases. It is a little bit tricky toe push to push the changes back to the database. But however, there is a way using my creations. So we're going toe our show these right now. Okay, let's say we want what a new column in the customer's entity that is remarks to before adding that the new column we need to do their below. First, we need to enable immigration's. Then we need my creation for initialization purposes with the flag. It could no changes. This will create an empty migration. We update the database and Now is the time toe afternoon column to our customers entity. So let's at, um, remarks. True calm. Let's say I beat and creating new my creation. We have the my creation this time, as you can see from the migration coat. Now, it captures the change with the addition off very much to column, and the last step is to update our television. So if we go back to the database now, we will confirm that these new column has been at it. Let's refresh our calm released, and as you can see, the column has been successfully added to the deliveries via our anti from or coat. 16. What we’ve learned in the Code First Demos: Okay, now let's review will have learned in the court first times. So we've learned how to create in the Net contr application in C sharp. How to create in the Net Windows forms we applications. He sharp how to use the court first workflow for data access along with creating a noon database from the model How to use the court. First, we're flow from there access against an existing database and how to handle there are based on model changes. He was in quote my creations. Now we know how to use it if somewhere called first, our next set of demos has to do with Motor Fest Went float in the demo right after this lecture is tool built and the Internet console application using that the framework with model first workflow. 17. Build a .NET Console App Using Entity Framework with Model First: we continue our their most this time with showing how toe build into the Net contr application using the entity framework with motor first workflow in this demo who were creating new console application dot net Using C sharp, we will visual create on emptied in data model via the anti framework designer we will generate and deliveries from our model read, write and data. Save the changes and handle model changes. Okay, we're packing our test environment Ready to work with Model first were flowing into the framework. So in Visual Studio 2017 we go to five new project and since we're beating across application, we select concert up that net framework. Let's name these application if model first concert clear. Okay, and our workspace is ready. Just like the other demos. I'm going again and the right kicking on the Project Select Art New I Tim. And from the data category, I select a T or dot net and telling data model. Let's name our model DP model, just like we did in the previous Normal and now she's were working with a mother fast flow . We will select empty anti framework designer modern. These will allow us from design theaters will want the markings associations and then eventually generating database. So this is the designer you can at objects for the designer by other toolbox or I just right clicking on it and select arty New. So how we love to Entities will name the first into the books, and another one and authors I m stands for Modern is, um, convention that I'm falling for this example. Okay, the next step is twat. Some scaler properties through the entities, for example, for their and books table. Besides the i t. I want to have a string called Title that is the title of the book. Okay, for the authors, I want another skill of poverty called name that is the name of the author. Let's keep it simple and know that any other scale of properties I showed you the way you cannot as many properties as you want in when producing this demo. Now let's create an association between these two tables by right clicking on empty space Here in on our designer window, we select 20 new association entity framework designer such as these decision between two tables. I will change the name. So it is an association between books and authors. And here we have two ends of the association on the one and we have em books table Multiplicity by one. And we have the impulse for stables on the other end with multiplicity, many. Then the corresponding navigation properties would be created as well. So these association means that books have many instances of him authors. So, for example, we have have towards him and also to have one business off ambush. This is just for demonstration purposes. You can create other associations at more scaler properties, navigation properties and so on. Okay, let's a Pete our solution. And now we are ready to generate our database by our fleeting again. We can select Jared database for model here. I'm going to creating the connection. Since I want to creating a database. By the way, you were going to use an existing database. You need to be very careful in order not to overwrite any other objects that exist on the base you want to use. Since this is a test environment, I will create in June database. So I will name my database. He f underscore motel cultural I would think OK, and I will get, um, pop up measuring that. There is no such little base. And if I like that is to be creative penny wizard. Okay, I click on guests and the database will eventually be created. Click on next, and now I will be presented with a D d. L T sequel script for creating a database objects. So by now the wizard created the database. Let's double check. It's refresh. Here you can see that the database E F motor console has been created. However, that was that did not create any that I base objects inside the database. The reason for that is that these delegates generation process by other model fest workflow generates the necessary DTL for creating the objects it does not directly create. The objects in the database so quickly can finish. A new SQL file is created. You know what a project and we can, either. Corby the Colin Ran advises a mix or directly connected that I raise from within visual studio and ran these esque rail coat against our database. So this is the DTL screams, and basically we create the corresponding database objects as defined in our model in the designer. Okay, I will pick on the execute battle here and that will be prompt to set the connection. When did the pace? So again, I specify the super server instance on name I would leave. The database is different because it is a is defined. We've seen the dizzy excrete and I can see that comin was successfully. So now if we go toe pacto seven management studio and refresh at the table least on the on our database, you can see that the two tables are created. Also, let's create a diagram to see if, indeed, there is a relationship between the two tables. And yes, as you can see, there is a foreign key constrained between two tables, and we have the M Books I D Column in em offers table that references the I. D column in the end Books table. Excellent. Who came back to our product? We just with you. The next step is to retrieve some data from the database, but of course, scenes. Our database has no data. Let's first at some data in the corresponding tables. So since this concept vacation, we will write senior quote like the people's demos where we had consul applications for the treatment. Taylor from the databases as well, less inserting records. So we use how the name is Debbie Mother Container. These was a tropical creative during the wisdom where we generated database. We could modify these and gave and another name, but we kept the DB mother contained names, so we're going to use this one. So let's first create a new book. Idea will be popular to medicalization Sixties. An identity column Primary Kim. So I will just set the title for these in your book and via that method Oh, a lot of these, you know, a record in the table and books save changes. We built our solution. Now let's up in command. Prompt Not that who execute the coat. - Okay , let's go back toe Super 7 March, Mr You, and check the contents off them books table. As you can see, our new record has been successfully inserted into the in box table and let similarly let's at another record in the author's table. Referencing this record we inserted in them books table with them and now let's right click on the AM authors table she was very much Mr Dio to double check either record was indeed incident. See, the no author record has been successfully inserted in their 11 table. Now let's retrieve this information from within our application and after to show that they that the labour process is well so we remain in them using called Global Created. But you're pinning new sexual that the doctor is via that would be more the container. And let's right the relevant link query in order to retrieve the day that we want. So I'm creating you. Object has the TV, the authors, for example, and now via a forage enumeration, we would be able to read all contents or the table that the Okay, let's run our query after, of course, we repeat the solution at, As you can see, the first that I called for. The table has been successfully retrieved. Let's at another, um, also record and there to you again not to see that Now we will get to records and you can see that now are application of the thieves to record from the relevant table. Now, the last thing left toe see in this never is how we handle model changes in the motor fresh workflow, so this will be much easier than the code. First we're flow. We go to our there are model, double click on Deep Model and let's say we want what? Another column in the Ambac's table? So we radically here the art in you scaler property. Let's name it applies, for example, And let's said it's type toe double. Okay, we rebuilt our solution and we can see that we get an error we cannot have about No mapping specified for the price called There is a week of this error is because we first need attracted our database and then repeated the project. So now if you click here and select Jerod deliveries from model, it will generate DTL for recreating the entire database with again the tables. And the new columns were, however, these his dangers because if you have already database with data, you will lose all the date. So the safest way to do these two, I mean toe at a new column, is even though you have added it here on the NTD via the entity that the model designer you can go to the corresponding table by. Yes, he was having management studio and do the update there as well. So if we called books two columns, we select new column, Price said they flow to do the time. Okay, Now you try to repeal that. Can the solution it will be successful Can see that they repeat off Our product was successful. OK, now our demo has bean completed and we are rented toe pursued with the next demo. That is, we will see how can build and the Internet and going application using the anti frame with more the first. 18. Build a .NET GUI App Using Entity Framework with Model First: in our next time we're going to see how we can build in dot Net we application using 80 framework with mother first workflow. So in this demo, we will create a new windows forms way up in the Internet using C sharp, who will visual create an entity in data motor that this medium will generate interest from all model reading right on data save changes and handle model changes as well. So, back in our testing vitamin A, can we creating new partners Visual Studio 2017 And this time we're going to build a windows, forms up the tents family Let's name it if motor first we okay, so we have taken our project. We goto art New Itim And in the day that category, I can we have a navy odor tonight and student data model. We name it deeply model would pick next and again create an empty anti framework designer More than so, um, for purposes of simplicity, will just at a single entity. This time we show in the pews them how we can create it to entities and define association between them. That is actually before a key constraint. So now for this demo for the sake of simplicity. Who? Just just creating new single entity. Let's name the center, the employees. You can see that the key property society and it is the dilatory in teacher. This is a different behavior. You can change it if you like, But in 99% of the cases, there's always Ah, 90 column in every table. So this is our entity. I will just add a new scale, a property, call it first name at another one, call it last name and generate the database from my model. I went to creating new connection because I'm creating again and knowing that the pace for this demo who will name the database you have underscore model on the score week legal. Okay, again, I would get a prompt saying that there's no such the levity. And if I want to be with that created, I will. Cleveland Yes. In order for the base to be created again, connection settings will be saved in the up graphic file with the name D be mortal container. That's okay, I'm using it to from where six and now our tedious creep is being creative. Okay, the files generator keep on finish. And since this is immune database in that, I don't have to worry about and in Dallas, because everything would be noon. It's It's some brand new therapies that did on taxes before. So I will directly execute this cold in order for my data base objects to be created and the commandos successfully completed. Let's go back to our super savory instance. Why, yes, it was ever manager studio and double check even database was created along the table. Services on the and employees table is right here with a cold with Fine. Okay, let's proceed to the next step. Since this is a great application, everything will be much easier regarding data access. So we go back to our for data sources and we had immune data source and, um will be getting the data for these letters from on object. So we go toe if mother physical we and here consider there is class this employees who will be used for retrieving data from the corresponding table in the underlying database. So when dragon drop these option isn't there a review on our farm enable the save button as well as at very fresh battle. Excellent. Now it's time to add our 100 quote plus F seven and first let's at the 100 quote for retrieving and data from the database. So Winston she ate a DB motor container in the former load. I've been called by creating a new DB monitor content object. Then we create at least off the employees table, of course, and finally said the testers for our biting source. Okay, now, before running application, let's at some event Italian quote for the same battle and the refresh button as well in the save button. Just having caught with the save changes method. And it will take care of everything that has to do with pushing on day that changes through the database and about the refreshment. Wanna just at a refresh called toe our Delek review Excellent. Were ready to run the application. We they built the solution first. Okay, they succeeded. We feel in the style, but in order to debate or application. So this is our simple gui application. Thes are the contents off the employees table are located. Let's at some data and try to save it and see if actually these data are start back into the employee's table in our underlying deliveries. Okay, we click there. Safety of the battle. Let's go back to our database and the right Keep on the employees table. Select top 1000 rows to see the corns on the table. And as you can see the day that has been successfully inserted in our database table, we hear the refresh button and we can see the light is here as well. It seems this is that he's an identity calling because its primary key as well and vital, populated automatically. So now let's modify these records. Click again on safe battle and check again. You see what's happened? Management with you. You can see that identification was successful. Okay, great. So no one about If we want wanting new call, go to the employees table in SMS. No column. Let's name these calma remarks. Parker 250. Okay, are change was saved in the database. Let's update our mother as well, and you can see that our employees entity was successfully after this from the database. So now it contains the remarks, poverty as well and the right people and go to table mapping. You can see that it is mopped toe. The corresponding column in the database called remarks His repeat. Our solution maybe succeeded. So now you will go back to our form. We can at it columns for our direct review and at there you much column is with that's repealed and that I can't application. You can see that now the columns presented and you can also at some day that as well. It would take the same pattern our day that will be pushed back to the database as well, because they safe changes. Method captures all changes automatically and bruised but through the database. So we clicked on the same battle. Let's go back to the database in Super seven Management Studio. Let's on a quick I can to see that our remarks column has been successful, populated with data via our form 19. What we’ve learned in the Model First Demos: this very cup of water have landed the model first time, much so have learned toe create a dot net console and Windows forms going applications in C sharp. We learn how to use the mortar first workflow for data access. How to visually designed the mother for Mentally framework data model designer. How to generate the rays from our model. How to read and write data in the database via the model. And last but not least, how toe handle database and model changes. So now we can say that we know how to use anti family mother first, and we are ready to proceed with the next demo. In the next time, we're going to see how we can build and dot net contr application, using their three framework with database first workflow. 20. Build a .NET Console App Using Entity Framework with Database First: So by now I have seen many live demonstrations off using the code first overflow in its variations as well as the model first workflow. The last word floor in that from work is the database fashionable float. This is the third quarter flow, and it is s important as the previous tour flows we have seen. So in this demo, we're going to see how we can be and that the next concert application using that the framework with the various first workflow more analytically, we're going to create a new cultural lab. Internet Music C shirt we will generate entered into the model from an existing database. We will discuss and analyze the generated entry. Did a model will clearly deliveries value Anti Vizzini tm are the new table instead of new record handled daylight three Well and rights post changes to the database. Check into the base from Super 7 March, Mr Audio and more so again in Visual Studio 2017 we starting new project is a consul up within that framework. Let's name it if database first underscore conscience and that cake on Project Select Art in new I, Tim And just like the previous times would go to the data category and choose twat on idea totin identity in data model. Let's name this model for purposes Places in DP model. Click on that. And now who will launch the anti formal designer from database? This is a database. First we're from actually. So we select these we keep on next, and the next step is to set our delivers connection. The I'm gonna use the sample database. Care in the beginning with this course for this demo. That is the sample. Underscore E f the base. That is the sample db underscore e f into the base. Let's choose that that I was from here. Test connection. Successful legal. Okay, here we can set their connection settings name. I will change it to DP Model entities, so OK, let's leave these one supposed to be underscored here. Fantasies select which tables to include in the creation of our model. I'm gonna include the others, his customers and orders tables, illegal finish. And now our databases being translated into and data model. It takes a little bit of time, and it really depends on the database. So s discussed in the theory part of these cars, the laughter, the database, the more complex that that a mother would be. And he said it would be difficult to maintain large data mothers. Okay, this is our generally did the mother. You can see that our three tables are translated into three corresponding entities with properties. Properties represent the columns off the tables. And there are also associations between these entities that represent their foreign Kiko states. Okay, let's, uh, repeat of our solution and let's get back to the program class in order to retrieve some information from the customer table. Our context classes sample did be underscore if entities no. And I was time to write our link quick again with for forage, no merit for ready to output of screen are the contents of our table. - You know what? Okay, that should tweet. Let's repeat, let's call be the path toe the execrable in order to running from the command front. This works incredible. Let's run it, and you can see that the data has been successfully retrieved from the table using our generated data model. Now let's ride a few record on the same table. The way is much similar to the previous console applications were created using the other models as well. So let's do these before they retrieval part. You know, Coach came. Okay, so you very cuss because no customer And with that, the policies I t with it is an identity column, so there's no need to specify the i d. Let's specify the first name. That's what the actress I t called Mag. You said it to one. Okay, now let's out of the dish. Numerical value. They are method called and last but not least called the save changes missing. Okay, we're ready to run our proper, and we go back to the Carcel with the comment from and ran back and application, and you can see a few physical has been successfully insect it because it was instead of ended youth from the NATO base. Let's double check by checking the table values. He was having a man dressed with you. And you can see the fifth record is here. So now what about data? Mother changes and they don't want change in the database. First, workflow It is actually and database change that is propagated into and delamater in a Watertown solution. So what happens if we go to the database and at a new column in the customer table? Let's add it calls here. And let's have a rematch too cold. Okay, let's say the changes. So now we have an additional call. Look the customer's table. So we right click here, Auntie, from well, did a model designer were at Click and we select who opted model from database. So we go to refresh tables. If we added a new table, we would go to what? And select a table. But now this is very fresh off an existing table. So we go toe very fresh top and we select the table. We after that or modified. So select the customer's table. We keep on finish. And as you can see, a new property has been added to our customer entity based on their corresponding change on the other line did of his table. Let's are built and that you can see our particles successfully build Excellent. So we have completed this demo with this Is that his first consul application? The next and final demo is to see how we can build under the Net boy application, using anti framework with AWS first workflow 21. Build a .NET GUI App Using Entity Framework with Database First: So this is our last time for this course and again we're going toe beat and the Internet applications using that is from where with the obvious first workflow. But this time I'm gonna be Windows forms. We application. So in this demo, we're creating the windows forms up into 20 Using C sharp wait to generate intended a mother from an existing database analyzed the generative and three there a motel quitted database via the data model art. A new column in the database put the provocative changes in the model. He said Records toe the table via the did a model and posed the changes to the database. All these we let us feel comfortable for working with the dovish past. Where Flo Bobby now our test environment. We in Visual Studio 2017 Again we go file new project this time was left with those forms up to transfer somewhere. And let's call it if Della pace first underscore gooey there. Just like all the peoples demos, we go to our problem, right? Kiko needs this solution explorer and we select what a new white him again. These new item belongs with the like Harry quarry off visual. C. Sharp attention teaches, Actually, the the old Internet entity in data model. Let's name it DP model again. Click on that and again was very workflow and free from a designer from the race. This database first. So we're here. I have already the connection specified. This is their sample. Db underscore e f connection. I can, let's say the connection. Citizen up Coffee as sample db e f entities. I will act the three tables again, address customers, orders And now my data mother is being generated based on the existing database. Okay, minded that motor has been created again. You can see we have three entities with their properties and associations. That is foreign key constraints. Let's repeat our solution. Okay, that was successful. And now let's go back to our form and at immune data source. I can we select object as the data source type, Click on next and let's out again the customer table. By selecting the customer corresponding customer class, they won't finish and we drag and drop. The source answered their angry view on the four. Okay, it's also at very fresh patent and also enable the same battle. Okay, time. What, Uh, some Hundley coat. You press f seven and Eustachy eight there, then his mother context class, that is sample db underscore E f entities. And in the form load coat, we. Instead, she ate his object. Next, we create, at least with the customer tables, condoms. And we said the Dennis was for our by the source. Okay, The next step is to add the 100 called for the same pattern of these. It quotes with the save changes method. You've guessed right and 100 coat for the refresh button that he's a quote with a refresh method of the customers. They that Okay, we are ready to around the application. We're going to start back home, and this is our application. As you can see, thes are there. These are the data currently in the customer's table. Let's try to modify some of these data and see here the changes are put back into the underlying database show. Let's update a record for and name it cause for a first name. Let's say so. We'll click on the safe, but turn and let's check back into the database via Yes, he was having moms to you. You can see that the record has been opted It Okay, now let's let's change our celebration, See if the mother is updated. So let's exit application and head back to the database. So this is our customer's table and lets out another cold. Let's quality remarks free. Go. Okay, Our table has been after that. And now let's up to the corresponding data model in our application. So we go back to the data model and this is our until frame or data model designer. Now we're at King on an empty space and select update model from the diabetes we go to refresh because we're efficient, existent table and he's a customer's table. It's elect Cuban finish and would consider remarks very has been added. Now let's do another change. So let's create a new table on our, you know, a little decency ive This table will be automatically added to our existing data model in our project. Okay, kind of table has been created. And now let's add it to our data model. Right Click in there and the frame or data model designer and which elect update mother from database. Go to the top and selected the table. We want what toe our Della moda alone with the corresponding options? Well, it is different. Acting paralyzing or single arising the general adoption names, including foreign key column in the motel and import and selected stop procedures. We click on finish. And as you can see, there is a new entity in our data model. These entities called country. Now you Confederate modify you cannot additional associations. And so what? Let's repeat our solution and you can see that our solution or successfully rebuilt Okay, let's proceed now with the next lecture and see what we have learned in the deliveries first demo. 22. What we’ve learned in the Database First Demos: So what have you guarantee that that that was first famous. We learn how to create it open and control and Windows forms boy applications. We learned how to use it at a bus. Fares were flow for data, access, help, toe handle, database and model changes. And now we can say that we know how to use anti framework that a peace first workflow in the next lecture we're going to review. All have learned in thes course. 23. About the Entity Framework Core on Linux Section: a much pleased to announce a new section. Other to these Onley course, the section is called Anti from a Core only. Why have I added the section? Because super server scenes version 2017 is cross platform or so because the next courts cross platform. Moreover, because anti from our core is cross platform to and because we live in a cross plat worked , meaning that nowadays is not just used technology on a single or presence is now you have options. Have the option to choose that net on Windows on Linux Box on Mac OS. Same stance for secrets ever and anti family core in many other technologies. That is the reason Excited twenties exciting new section, My only course in order to give another aspect off using anti framework when another open system such as a Baudolino. So what will we be examining these section? Well, what? Who set up a lot of development environmentally knows more specifically on? Guly knows. Therefore, we went when stall she was ever we start the command line tools. He stole Asia, the studio and also installed at night car as decayed. Moreover, we're going toe check the availability from our core database providers and were, Quentin's told the Super Seven writer. Moreover, we're going toe installed design component tools and last but not least, create an entity framework or cultural application with coat first. So we're going toe. Create and use in new database on Super Sever Onley Nukes Valya Anti from our core Great yes, work crews path from. 24. Supported Linux Distributions by SQL Server 2017 or later: seen Super Sever 2017 that is support for installing she was ever on Lino. Let's take a look on the supporters Lennox Installations for sequel server 2017. Later, we can install she was ever read had early knocks. Enterprise Edition We can install it on Shoe Silly Nukes Enterprise Server on Baudolino sh We can around source ever on dark hair as well as we can. Provision sequel VM in Asia Installing Super 70,018 Preview on Lino It's Ah Ready really easy task because that is comprehensive. Implementation provides by my So we're going to see a live demonstration off installing Super seven. Twitter's an 18 city PC on a Baudolino version. 19 point over. Let's Proceed Twin demo. 25. How to Install SQL Server 2019 on Ubuntu Linux: So here we are on our test environment. This actually virtual machine where the guest always is from Baudolino. 19 point or four. Okay, The first step is to find the instrumentation provided by Microsoft in orderto follow step by step, the process of installing Civil 70,018 city P three on these addition and version of Linux . So let's search for the rotation. So we find the vision limitation. Get static Civil several. Boon do Park off Microsoft dogs. He's a quick start and this is the You are ready. Okay, First, let's take a look on the perquisites unit. Uh, I'm gonna do Lennox distribution with veteran 16 04 or later. We have police took a much memory. This is a boon. Do 19 point off or so it's innovation than a 16.4 I have two gigabytes of memory and let's proceed who? They're comments. So the first step is to install the EMAs Super seven package. So we copy the w get command, we open terminal and we run it. Okay? Any chance our passwords in order to get at Mr Consul and next, we need to register the problem repository now for installing suicide 2017 Well can run these positive restriction command, however, since we want toe test Super Sever 2018 City P three. So this is a preview version of serious ever. We can use this repository, which is the M A sequel server Preview released. So let's copy these and Chinese you know it's happiness. Okay, so we have successfully registered the proper repository for installing Secret Service 2018 City PC No, the next day history on these commands in orderto update Our Repository and then install Super Seven. So let's around after Command Fest and now let's start this relation off sequel server. So now these will download the actual media of Civil Server 2018 City P three. It is around 224 megabytes, but if you have ah, fast connection to the Internet, it is just a matter off a few minutes. Okay, the media was successful, downloaded, and now this dilation process starts. At this point, I would like to mention that it is off course offers, but I need to mention these for this type of installation of sequel server for this live demonstration for example, you need an Internet connection. OK, excellent. Now, in order to complete the set up off sequel server, we need to run this command. This Communist also included in the quick start documentation conceived here. But it is also reported by the installation with that off sequel server. Okay, Now let's clean the screen and run the Vermont. So these allow us US toe set up the relation of Super Seven. As you can see now, we are prompted who select on additional she will sever. At this point, I would reformation that it is critical that we select the proper additional Super Several , for example, thesis a city P. So I'm going to select the immigration addition which is free. If it was ah released one factually version of super served, for example, you will, when installing. She was there in 2017. If you were installing service ever on a test environment for non production purposes, you quote in select, for example, developing additional, which is free or express addition. However, if you select appendage of Shiva's ever, for example, standard enterprise and the press corps or web, you need to make sure that you have also purchase the probably license for where it'll sales channel and you have a product. Heat went Okay. Now, since this is his a test environment and we are starting there city P vaginal civil 70,019 let's select one, which is immigration. So here we are presented with have earnings, toe the license terms. And if we agree, we need to type, Yes. Otherwise, we type No, I agree with tear. So I type Yes. And now I am prompted to enter a civil service system things their passwords. That is actually the S A users password. So, yeah, make sure that you interned a secure password. Let's confirm here we get the message that this is not a relegation vaginal sequel server. There are 173 days left in the migration period. No, concede that some more features are being enabled for the for these instance of sewers server, for example, for flash L. Feiler would get the message set up has completed successfully and that super silver is starting. So the last step in these live demonstration is to confirm that actually, yes, civil service service is up and running in order to do this. We run a system city l studies comment. So we go to the quick start and we copy this command. So actually, this command instructs our legal system in order to check the status off the images. Krill, Kaif in server service. So let's go back with her male and execute this command. And you can see that the super cell service is active. This running and you can see here the original time stump where she was ever what successfully started that these 54 seconds ago where this relationship was ever were successful completed? 26. Available SQL Server command-line tools in Linux: now that we have successfully installed servers have it was in 19 city P three on our test Baudolino spiritually machine. The next step is to install Supercenter command line tools. Also on these distribution off Linux's on our test environment. So why do we need these tools when it was not ableto around? T seaQuest statements on the civil seven instance. So for doing that, you can either use Asia has to deal with these cross platform and we will talk about later or command line tools. So what else? He was had a commander Command line tools. The Continentals are S Trail CMD, which allows you to run Tisco statements, system procedures and script files through a variety off available most as well as BCP, which is the Ball Corby program which allows you to Balakot been daylan between on. It starts off Microsoft sequel server and then identify in a user specified for months 27. How to Install the SQL Server command-line tools on Ubuntu Linux - Demo: now let's install servers have a command line. Tools on a Baudolino version 19.4. The procedure is twin for the public repository. Jipping G Keys registered a Microsoft Boudou repository after the sources list and around Destination Command with the UNIX told BBC developer Package optionally we can at the path to our Super Seven commanders to our pattern vitamin variable in and bash shell in order to be easy accessible. Let's proceed to go there Live demonstration. So here we are back on our test environment on a Baudolino and we are between store serious ever command line tools. The procedure for doing that is included in the same quick start documentation We checked earlier for installing civil server on a boon. Do so it was full down the document. We can see that in order to proceed with historic Civil seven commanders, first step is to improve the public repository inju PNG Keys. In order to do that, we need it. We ran these Carol Command. However, you can see that the chemical was not found because these utilities nothing start on our Linux virtual machine. But we can easily in started with Sudo apt install curl so we could be this command and we're on it. You know, the twin stole these utility. Okay, so now we're ready to proceed with starting the commander tools. So Iran, their care command first. No other to impart Republican President, you PNG kiss. It's clean screen. So this first step was successful. Now let's register the magazine. Bondo repository. Okay, so now let's update our sources list And the RAV installation commander with the UNIX or BBC developed package, I can we need to check and accept or not their license terms. So now they're installation process continues again. More license terms and installation was successfully completed. It's an extra step we can at the path off our she was Circum Island to store path environment. So I will do that. So I can just around these command as well as what kind of these comments here noted toe make s Christianity and visit P accessible from them. Passions shell for interacted, non looking sessions. So again, we modify our path this way. Okay. Excellent. Now have successfully installed command line tools 28. Azure Data Studio on Linux: A Cross-Platform SQL Server Client Tool: Now let's see another interesting aspect off working with sequel server and looks in this lecture we're going to talk about accessing serious attitude was in 19 currently City P three on a bundle in looks using Asia There a studio now a few words about Asia. There's to deal Asiad ESTUDIO is afraid to. It is Microsoft's cross platform that I was tool for its own premises. Their platform see whatever as well less for its cloud based platforms. Asia sequel to the Base Asia Single Day. That warehouse, etcetera, it is cross platform. That means that it can run on Windows, Lee knows, and mark always. It offers reach customizable dashboard, and it is extensible. Now, the current system requirements about Asia, the studios that you can install it either on Windows 10 8.18 or even Window seven with SP one. You can also install it on Windows Server 2018 to 2012 12 to 2016. In 2018 Consulate. Install it tomorrow always 10.13 high Sierra or Mac OS, 10.12 sierra or later. Moreover, it kind of started on lean looks that is for example. A Red Hat Enterprise. Linux's 7.4 later 7.3 or later Shoes E. Lee Knox Enterprise. Ever version 12 SB two or later, as well as on a boodle eunuchs version. 16 point off four or later. The system requirements are constantly updated, so you can check often these u R L for these system requirements, and you can let more about Asia to the studio on these rather last but not least, know that about Windows on Lee, 64 bit versions are supported. 29. Access SQL Server on Ubuntu Linux by Using Azure Data Studio - Demo: now let's install Asia. Their studio on really looks. So we're going to install age of the studio on the same Milena looks teacher machine. We work in previous lectures and 11 illustrations. So that is a Mondo Lee looks version 19.4 and the procedure is straightforward. Therefore, we went to download install the latest release. So just installing and launching their tool and either an issue can install as well missing dependencies. Okay, let's proceed to our on demo. So I'm back on our test environment on our virtual machine. Let's download Asia, their studio farm Angelenos. So we such for Asia, their student download and eventually we end up to the official Microsoft website. And here we have access to a range dollars so you can see that here there are the stars were all path forms. Next in store for Windows remark aways and Lena. I'm going toe use the tar dot urges it Mr Elation package. So let's download this and I'm going to save it. Mr. Leisure Media is about 124 megabytes, so allow a few moments in auto tune downloaded and the main table below on these official website. We can find installation instructions. So we are downloading the charges. Aaron Installation Media. So this is a procedure to follow. Let's take a look if our installation is completed, so we need some more time and right after installing and trying to launch hedge it a studio . Either the problem. We can check about any missing dependencies against them. Based on these excellent argument, by the way, while waiting for the installation media to be downloaded, we can copy these commands and prepare them from execution. As you can see here, we need to replace these words registering with the proper version off. A jitters were that were downloading, which is currently 1.8 point zero. So let's open, aware process are and paste the commons there in order to modify them. Okay, these are our months. So we replace these string the probably shot were downloading. Okay. And the next one as well. Okay, Our commands already. Let's go back to our interview outside and check if Mr Relations completed. So not yet. So currently, I'm experiencing a slow internet connection, so I have to wait a bit more. By the way, if you don't have anything connection. You can download the installation media from another computer and you can place it on your links environment. United to be ableto proceed with installation procedure. So now we can see that our installation media for Asia The studio has been successful in downloaded Let's check its location. So that's right. Legal need open containing For that. You can see that it is in mine download folder. And this is the name of the file. Okay, Now let's go toe the word processor and start coping and executing the commands. Let's clean our screen. And Okay, so now let's change director toe downloads. Okay, that's good. So now let let's extract the condoms off this. Um Okay, let's delete this empty space here, so yeah, let's run this command enough to export. And now we're exporting all agent last few files from the archive download it from the official website from Microsoft. OK, and let's update our path Very apple. And the last step is true. Start Asia their studio, honey. Yeah. So if this is the first time you are working with civil, several only nooks and the you are in the process off connecting to indelibly changing resignation there. Studio picture that we consider these moment at their peak, just like I did when I first did this. So now let's connect here. Let's just put a local host with a dot, for example, and the letter again. With that, they say, User, we created during this relation of Super Saver. Okay, let's connect, and you can see that we're have a successful connected to our instance off. Serious Era 2018 City Pizza 3.0 on Baudolino. Let's maximize this. And now we are running in graphical. I use the interface tool that these Asia, their studio, an excellent client will for Civil Sever Cross platform. And in these Linux's environment, we can access our database and run queries. For example, let's type here new query and let's creating onto the base. So we have intelligence we can wear with sewers ever, just like we were in other open systems, for example, in Windows or on Asia Secret to the base. So it is business as usual, so well, it's kinda database. Let's name this deliberate test everyone antilla. The Taliban has been successfully created. Now let's change the context off our query window to these babies will create it, and this is testing you on. Now let's get a table. So lets include two columns and I D column. The witches Primary key. The coat barker. 50 Problem. Let's around the command. Also, let's import some day, turn out in table test. Excellent. And let's run a simple, select query or the check the table's contents. You can see the intelligence feature is really amazing. These are the contents off the sample table we have just created and popular whose test data and let's expert please excuse me. So let's expert toe downloads fault, for example, or documents and the little name or file results. Tazi Zvi. So let's save it and this is our fight. So now if you really want to work cross platform, you can back up their base with a backup command. You can restore eat when another pair system with civil, sever the same version or innovation so you can really work cross platform 30. Installing .NET Core: Okay, now it's timeto instructed, not score on our open daily news. Developing environment. First, let's discuss a beat. What is the Limit Corp. Let's refresh our memory. Did not score is a cross platform addition off lieutenant framework. Therefore, it can run on Windows. Lennox and Michel Waste now regret leanings. It supports many distributions. One such despicable supported is a bully nooks, which is the distributional co introduced in these demonstrations? No, there are two flavors off the 10th corps. If you're just interested for running applications, you can use the net core around time. However, the very interested to build applications and in our example would between these because we're going to use anti from work and the right lieutenant coat you need looking at car as decay. You can learn more about the tennis court and the Internet on these girls. Okay, now, let's start on that court two point West K on Gulen's. So here we are by going over a development environment which is so brutally looks, version 19 point so far by now, have installed. It was over 2018 CTP three, the command line tools as well s Asia, their studio Now it's time to install anti from MirCorp. These is way to do these Eastern navigate with lieutenant remarks webpage, and from there we will select the proper version off anti farmer who install our system. So in our intern browser, let's such just for Internet court, and eventually we will end up to the official website. So here you can see your options have gotten downloading the Net. As you can see, you can select who download noting that for Windows, for Linux or for Michael West, there were Page automatically detects that we're running only knows. So the default option here is to download on that court now, since we went home built on application, using the core we need to download Northern at court. As the K even over just ran an application, we could just installed a tennis court granting, But this is not the case for us. So let's click on installed in that car as K. So here we select our links to the crucial. For example, in this demo, I'm using a Baudolino, therefore, on the looks retribution selection least I'm going to select on Boon do Russian 19.4 No before installing the Internet who need to register Max off key and feet. It is true that because everything is provided here, so we can just copy and ran these comments. So let's Kobe first command and let's hope our terminal and paste it here. Now let's proceed it with a second command. Okay, Now let's proceed with installing the net as the cape. We need to run these three months. Let's present for the next common just. Actually, you have to come. And for all what upped, Get utility. Okay, let's on up. Skate update And the last command is the actual that Net Installation Command, which is apt Get install tonight is the K 2.2. Now the next court is being downloaded from their repositories. If you have a fast in lieutenant connection, just matter off a few minutes, So the total download size is 91.8 megabytes, and I'm using a fast Internet connection. So undoubtedly with two megabits per second. So after a few seconds, the package will be downloaded. Not at this point at this demonstration is based on the assumption that you are running gleanings within it, and the connection in case you re tested for offline installation. That is fermentation called Who? Do that. And maybe we're going to cover these as well in a subsequent lecture on this course in the future. Okay. And now the packages out of being unpacked end up the net. Cord has decayed to point. Who is being start now? That cord is being configured. Okay, so this relation off doesn't core was successful. Everything When, when? And just to double check that we have installed in the net core successfully. Let's just college to see that we get feedback from the command. So we just typed up net and you can see yes, that the Internet was successfully. He start on a lot of bundu Lennox installation. 31. Entity Framework Core Database Providers: Now let's talk about NT for Makor, the service providers who loved it up his providers, there was providers set off layer practice that goes by applications for connecting 20 friend databases. So by a providers you can't execute secret statements and get results. Um, based on the's SQL statements sent farcical from to the database. No ive after knitted framework. There are many providers available for many. Measure the premises in this day. More Quint who install the IT provider for civil server in order to be ableto make calls to sequel server Onley Nukes via our anti family core project. Therefore, we're going to need lip of either Microsoft thought antifa McCord dot secret server. You can learn more about the available to appease providers for anti from our core on the below league. Okay, let's proceed. Install this. It was either for anti framework. Our own bundle e news. Show him back on our development environment on moodily nukes right after we have a success . Who installed the net caught? It's time to at the Devil's Provider for supers, however, has discussed earlier in the election. So in our interim professor research for is he from our core database providers. Eventually, we end up with today official websites for service providers by Microsoft for anti from what, and here you can see the least off card providers. As you can see, there are many providers formality, BMS is and many data platforms. And by clicking on there and you get package, you get more formation in California. Started the provider so your case will keep on Microsoft NT Family Core sequel server Is that to get more information on how we can start this service provider? As you can see, the latest veterans version 2.2 point six. And since we are the net core, okay, go on the Internet. She lie next to get the proper command to be executed on our terminal in order to out Sequel server, the service provider for anti from our core. Now, in order to install the provider, we need a product fast because it provide very installed per project. So fares were going toe creating new project with the Internet and then install the provider for our project. So I will create in directory and name it projects, and then I'm going to create another directory and name it Concert up one. Okay, now I'm going toe creating you. Definite project the type concert. Okay, now for our project and let checked five first you can see the fighter here. Let's up. She was server provider for anti family court. Okay, Now let's also at another package which is then design package, that it will allow us to use Farage Toolbox off nt Family court only. So we at Microsoft dot and he from our core dot design package. OK, Excellent. So now have successfully installed the database provider for super server for our new project on anti from work or only knows as well as the design toolbox and we are ready to proceed with our project. 32. Create an EF Core Project: Code-First with New DB: So by now you have successfully installed She was every 2019 CTP three on bully nukes When start the command line Tools Asia list with you have successfully installed the net caught We started a new console application and we have successfully at it the therapist provider for Secret Server as well as the central books for NT from a corpse. Now we're all said not to proceed with creating energy from work or project only knows this case We're going to create a court first, nothing new database project on at you from our court. So in this demo going toe creating narrative, however core product Lennox, we will use the court first workflow we will define the motor via the main class. Then we're goingto are creating new database using anti from our core decoration. So will connect with Super Seven with the 19 Lennox And finally we will connect to the database via our application and ran inside quids. Let's proceed with them So we're back on our development. Barrowman on Boolean looks right who continue right after we have successfully at it. The database provider for C was ever as well as the design tool books for anti from a quote Hey, let's close it in breath without made it anymore for this administration. And first, let's connect worse it was. Ever instance off the Salinas installation. That's to check what we have their pirate who created it. Here's so I will look in with the say and you can see that the only thing that Travis A tested a base called Testy Blanc was created in a previous life demonstration. Okay, let's minimise these. And now we're going to work with some source code for this purpose. We need an editor. You are familiar with you? Yeah, you can work with the eye or install any other source, code editor or text editor that, like my case, I am using Jeannie use a pretty useful graphical user interface editor. So let's open them programs. Yes, So we navigate to projects Consul up one, and this is the program looks Yes, file can see that the only thing that happened now is ah, hello, World right line command in their main method off my program dot CS five. So we can Randy's with the Internet a moment. You see him? This is output. So simple example just to see that our new Internet core project comprise Okay, no, let's work with anti family court. In order to do that seems work. Using coat first, you need to define our model. To this end. I went to creating new file and I will name it Mortal Dots. Yes, Inside this file, I'm going to add some cold noted to specify the entities to be created on the database. So back on our editor, we create a new file. And let's say we like in the projects, Consul upon falter and name it model dots years. Now let's at some cold. So these the cold I have just added on my model doughty s class. You can see that I'm including three name spaces, foresees Microsoft dot nt from work or the 2nd 1 is Microsoft dot anti from her court. Thought she was ever because I'm going to make horserace sequel server and I need to include these names base as well and in fact, 20 system that collection all generic because I'm going to use they want to many relationship and I need to be able who use a collection. So I have two classes they made two classes are student and great, So I have a student entity with student I t type integer with also student name, off type string, and this will have a collection off Great. And each grave has Corsetti and the Great. Also, it has a stupidity. And as you can see, this is the way I create the relationship between grades and students. Also have these two visual entities because they're going to be used in the program that CS class and another very important part of it. These class is that I'm using TV context options based there, and I use the method used sequel server and here I specify the connection String for connecting to Super Seven is you can see since account have a different instance She was server. Lee knows I'm using local host our specifying then deliver his name. To be clear that that is F D B. What? And also I'm specifying the user ready, which is currently say as well as the passwords. Okay, let's save these. And now let's go toe program. That's yes in order to change it as well. So with the lead, the hollow words from the main method and a mounting these coat best in which are making a quote to the students context. So I'm kidding you object off type students context based on which I'm adding two new students in my in database. Then I save my changes and get the number off records in setting the little peas. Then I could render the base and the ITRI all the students in order to show that after the incident the data in the database, I can also successfully retrieve it. Okay, let's save now. There are two more steps in order to complete is them? The first step is to call my creations in order to create migration package based on our on the wing closet is the model taught CS based on which the new database, if TV one will be created, then we can around our program in order to make the course main method that is other students and also retrieving the records bath and displayed on the screen. Okay, now let's execute my creations tire for executing the whole program. After we execute migration, we're going to use Asia the studio, in order to check that indeed that it name. You know, the race has been successful, created based on the migrations package off our anti from our core project. So let's create their my creche package. So I just got an error message that the anti type graded quite panicky to being defined. So let's go back to our coded tour. And yes, indeed, I've got what power key for? Great. Let's do this. Okay, This is a great opportunity toe remind you that since we are only looks now, you know she's can sensitive. So be very careful with capitals. For example, in the connection string if use use their i t. And instead of capital I, ah, lower case d you put capital I capital in d. It won work, So we need to be very careful with case sensitive commands or connection strings and generally everything in Lenox. Because of these case sensitivity, you need to be careful, not or not who end up with difficulty, errors and the complex Tapash. Okay, so let's tag into creating migration package. So let's clean the screen and the commodity in this community of my creations at initial db create. Initially, we created the name I gave to my migration package. So let's hit interagency. Great. So are my creation package has been successfully created. The next step is to up to the database in order for my questions to actually created the database on our civil sever. Instance on these leaks environment. So the command to uses that net years they face update. Let where the beach now anti former core via the provider, connects to see whatsoever and applies the migration package earlier created. So eventually these will create a every B one database alone with two tables, students and great. Okay, now let's go toe Asia their studio and check. If indeed that is, the base has been success will create it. That's right. Click on terror base and select Refresh and you can see that our terabytes has been successfully created by our anti former core project. Now let's expand the tables and you can see that have the crates table Industries table as well. However, if we were on a query, we won't be seeing in data on these two tables. The reason is because even though we're on a Mac relations with not actually ran our procomm it, so we need toe run our application in order for there called Inside the main method to be executed as well. And if you remember these cold actually insist to record see now our students table and then retrieves his records and displays them on the screen. But first, let's double check that even though our database in tables have been successful created, they don't have any data. You can see that. Indeed, there is known data in The Grace Taper. Let's also check the students table and, yeah, no data in here either. Okay, now let's proceed and execute our the 10th application Enough stuff for some data to be inserted in their students table. The command is look, net it on, and since we are in our projects falter the program would be executed and execution was successful. So to records saved the database. And now this is the result of the query after their to his statements, with thieves the least off students inserted in them database. So you can see that all students in the database our Susan one has to into let's double check these via Asia to the studio, so go back to Asia Studio and we're on the query Select Star from DB O students. And you can see that indeed, the two records have been successfully inserted in our database. This was an example off using entity framework or on Lenox, along with connecting to shippers ever via the directors provider for anti from our core in future, lectures were going to do even more stuff in Lenox using anti framework. 33. What we’ve Learned in this Course: So what have we learned in this course? In terms of fury? We learned what anti from worries. How it can help you build robust applications in the Internet. Found us anti framework work. We learned about the significance off the DB context, and Deby said classes in anti framework and, of course about the available were close into the framework that is called First Mother. First in database first in terms of properties with so many live demonstrations by a wish we've learned the following We are outta built in the Internet. Confident Windows forms buoy applications in C sharp. How to use anti framework for populating we controls with data retrieved from the database . How attracted back of the database with data via the data model. How to use all availability from were flows and subway flows for their access. How toe handle model changes and last but not least, how to handle deliveries. Changes take very much for taking my course. I would really appreciate it if you could take some time. In the huge course. There are many more courses off. She was evident net hobbies that are occurring soon on statute, Thank you very much and I wish you all the best