concept database server in category entity framework

This is an excerpt from Manning's book Entity Framework Core in Action.
The first issue is object-relational impedance mismatch. Database servers and object-oriented software use different principles: databases use primary keys to define that a row is unique, whereas .NET class instances are, by default, considered unique by their reference. EF Core handles most of this for you, but your nice .NET classes get “polluted” by these keys, and their values matter. In most cases, EF Core is going to work fine, but sometimes you need to do things a little differently to a software-only solution to suit the database. One example you’ll see in chapter 2 is a many-to-many relationship: easy in C#, but a bit more work in a database.
SQL has a useful feature called user-defined functions (UDFs) that allow you to write SQL code that will be run in the database server. UDFs are useful because you can move a calculation from your software into the database, which can be more efficient because it can access the database directly. EF Core provides a feature called database scalar function mapping, DbFunction for short, which allows you to reference a UDF in your database as if it were a local method.
Listing 8.7 Configuring a computed column
protected override void OnModelCreating (ModelBuilder modelBuilder) { modelBuilder.Entity<Person>() #1 .Property<DateTime>("DateOfBirth") #1 .HasField("_dateOfBirth") #1 modelBuilder.Entity<Person>() #2 .Property(p => p.YearOfBirth) #2 .HasComputedColumnSql( #2 "DatePart(yyyy, [DateOfBirth])"); #2 } #1 Configures the backing field, with the column name DateOfBirth #2 Configures the property as a computed column and provides the SQL code that the database server will run !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":3,\"ch\":4},{\"line\":3,\"ch\":33}],[{\"line\":6,\"ch\":4},{\"line\":6,\"ch\":33}],[{\"line\":7,\"ch\":8},{\"line\":7,\"ch\":37}],[{\"line\":8,\"ch\":8},{\"line\":8,\"ch\":30}],[{\"line\":9,\"ch\":12},{\"line\":9,\"ch\":45}]]"} !@%STYLE%@!
Figure 8.2 Because EF Core knows that
YearOfBirthis a computed column, it’ll read back the value of that column into the entity that took part in an addition or update to the row. When you read a computed column, the database server runs the SQL code to recalculate the value to return.![]()