Summary

We covered a lot of ground in this chapter. Since practice makes perfect, I always recommend that everyone tries out the covered concepts by writing code and experimenting. We looked at some new modeling techniques. We saw that we can create additional classes, called complex types, to group properties common to multiple entities to ensure consistency in our models. We saw that using enumerations in models can lead to more readable code, and were convinced that Entity Framework has first-class support for enumerations. We saw that we do not have to have the names of our classes and properties match database structure exactly. We could use the HasColumnName and ToTable methods to provide alterative names at the database level.

We looked at many advanced query techniques. Most concepts can be used with both the query and method syntax of LINQ. We used projections to select subsets of columns from one or more tables in a single query. We saw how we can accomplish projection queries with anonymous and explicit types. We saw how we can aggregate the data to compute maximum, minimum, and a sum of data to get single values. We were also able to group the data in more advanced ways, providing grouping by many properties, and aggregates inside the same result set, using the GroupBy method. We looked at how we can use the same technique in order to accomplish the LEFT OUTER join functionality, and the ability to retrieve the data from the left-hand table, even though there are no matching rows in the table on the right. We saw how SelectMany can be used to create a functionality similar to JOIN in SQL, where some of the data from one table is repeated in matching child rows in the result set. Finally, we took a look at set operations that allow us to find distinct data as well as combine data from multiple queries via union operations.

In the next chapter, we will look at working with stored procedures and views, and database artifacts that do not map directly to entities, as tables do. We will also see how to handle concurrency, a circumstance where multiple users try to update the same data at the same time. We will understand the advantages of using Entity Framework's asynchronous API.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.249.42