Modern Data Access With Entity Framework Core: Database Programming Techniques For Edition Holger Schwichtenberg
Modern Data Access With Entity Framework Core: Database Programming Techniques For Edition Holger Schwichtenberg
com
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/
textbookfull.com
https://textbookfull.com/product/physics-in-the-arts-3rd-edition-p-u-
p-a-gilbert/
textbookfull.com
Online Banking Security Measures and Data Protection
Advances in Information Security Privacy and Ethics 1st
Edition Shadi A. Aljawarneh
https://textbookfull.com/product/online-banking-security-measures-and-
data-protection-advances-in-information-security-privacy-and-
ethics-1st-edition-shadi-a-aljawarneh/
textbookfull.com
https://textbookfull.com/product/harlot-hush-2-1st-edition-mary-
elizabeth/
textbookfull.com
https://textbookfull.com/product/shifting-corporealities-in-
contemporary-performance-danger-im-mobility-and-politics-marina-
grzinic/
textbookfull.com
https://textbookfull.com/product/fluid-mechanics-second-edition-
falkovich/
textbookfull.com
https://textbookfull.com/product/rural-people-and-communities-in-
the-21st-century-resilience-and-transformation-2nd-edition-david-l-
brown/
textbookfull.com
Reinventing ITIL® in the Age of DevOps: Innovative
Techniques to Make Processes Agile and Relevant 1st
Edition Abhinav Krishna Kaiser
https://textbookfull.com/product/reinventing-itil-in-the-age-of-
devops-innovative-techniques-to-make-processes-agile-and-relevant-1st-
edition-abhinav-krishna-kaiser/
textbookfull.com
Holger Schwichtenberg
While the advice and information in this book are believed to be true
and accurate at the date of publication, neither the authors nor the
editors nor the publisher can accept any legal responsibility for any
errors or omissions that may be made. The publisher makes no
warranty, express or implied, with respect to the material contained
herein.
Note You’ll see other case studies used in some chapters, such
as the task management app MiracleList.
The World Wide Wings use case deals with the following entities :
Flights between two places where the places were deliberately
not modeled as separate entities but as strings (this simplifies
the understanding of many examples).
Passengers flying on a flight.
Employees of the airline, who have supervisors who are also
employees.
Pilots as a specialization of employees. A flight has only one
pilot. There are no copilots at World Wide Wings .
Persons as a collection of common characteristics for all people
in this example. A person is not available on their own, but only
in one of three specializations: passenger, employee, and pilot.
In the object-oriented sense, therefore, Person is an abstract
base class that cannot own instances but is used only for
inheritance.
The World Wide Wings use case has two data models, explained
here:
The slightly simpler model version 1 (see Figures 2 and 3 ) is
the result of classic relational database design with
normalization. The object model is created by reverse
engineering.
Figure 2. World Wide Wings data model in the simpler version 1
Figure 3. Object model of the World Wide Wings data model in the simpler
version 1
Note The object models that were created in this book for the
data models do not represent an ideal object model because
Entity Framework Core does not support some mapping
capabilities, such as N:M mapping, yet.
The object model for the data schema of World Wide Wings
version 6.1 (Figure 3 ) was automatically generated by the Entity
Framework Core from the database (through reverse
engineering); I deliberately did not change it, even if some of the
generated names are ugly.
In model version 2, there are only the Passenger and Employee
tables for these four entities. Entity Framework Core is currently
somewhat limited and does not support table per type mapping (a
separate table for each class). Therefore, the table Passenger also
includes all the characteristics of Person . In addition to the
Person properties, the Employee table includes the properties of
the Employee and Pilot entities. In the table, a Discriminator
column distinguishes between records that are an employee and
those that are a pilot. Entity Framework Core mixes the concepts of
table by concrete type (TPC) and table by hierarchy (TPH). The
developer has no definite influence on the inheritance mapping in
Entity Framework Core 1. x /2.0. The classic Entity Framework offers
more options here.
The following are the extra dependencies in model version 2:
A Flight belongs to Airline (there will be only World Wide
Wings and its subsidiary Never Come Back Airline in this book).
There a Copilot entity here, but it is optional.
A Flight can optionally have an AircraftType object
assigned. AircraftType must have an
AircraftTypeDetail object.
Each Person and therefore each Pilot and Passenger must
own a Persondetail object.
In this book, both data models are used, partly in modified form,
to show certain scenarios (for example, database schema
migrations).
using System;
using System.Runtime.InteropServices;
using System.Web;
using ITVisions.UI;
using System.Diagnostics;
namespace ITVisions
{
/// <summary>
/// Helper utilities for Console UIs
/// (C) Dr. Holger Schwichtenberg 2002-2018
/// </summary>
public static class CUI
{
public static bool IsDebug = false;
public static bool IsVerbose = false;
}
public static void Headline(string s)
{
Print(s, ConsoleColor.Yellow);
}
public static void HeaderFooter(string s)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(s);
Console.ForegroundColor = ConsoleColor.Gray;
}
/// <summary>
/// Print with Thread-ID
/// </summary>
public static void PrintWithThreadID(string s,
ConsoleColor c = ConsoleColor.White)
{
var ausgabe = String.Format("Thread #{0:00} {1:}:
{2}", System.Threading.Thread.CurrentThread.ManagedThreadId,
DateTime.Now.ToLongTimeString(), s);
CUI.Print(ausgabe, c);
}
/// <summary>
/// Print with time
/// </summary>
public static void PrintWithTime(object s,
ConsoleColor c = ConsoleColor.White)
{
CUI.Print(DateTime.Now.Second + "." +
DateTime.Now.Millisecond + ":" + s);
}
#endregion
/// <summary>
/// Output to console, trace and file
/// </summary>
/// <param name="s"></param>
[DebuggerStepThrough()]
private static void PrintInternal(object s,
ConsoleColor? frontcolor = null, ConsoleColor? backcolor =
null)
{
if (s == null) return;
if (HttpContext.Current != null)
{
try
{
if (frontcolor != null)
{
HttpContext.Current.Response.Write("<span
style='color:" + frontcolor.Value.DrawingColor().Name +
"'>");
}
if
(!HttpContext.Current.Request.Url.ToString().ToLower().Contai
ns(".asmx") &&
!HttpContext.Current.Request.Url.ToString().ToLower().Contain
s(".svc") &&
!HttpContext.Current.Request.Url.ToString().ToLower().Contain
s("/api/")) HttpContext.Current.Response.Write(s.ToString() +
"<br>");
if (frontcolor != null)
{
HttpContext.Current.Response.Write("</span>");
}
}
catch (Exception)
{
}
}
else
{
object x = 1;
lock (x)
{
ConsoleColor altefrontcolor =
Console.ForegroundColor;
ConsoleColor alteHfrontcolor =
Console.BackgroundColor;
Console.WriteLine(s);
Console.ForegroundColor = altefrontcolor;
Console.BackgroundColor = alteHfrontcolor;
}
}
}
#endregion
Listing 1 Class CUI with Subroutines for Screen Output to the Console
The figures that appear in this book are available for download as
well, which will allow you to see them in a larger, color format.
Now that you have been introduced to the plan for the book, the
mock company I’ll be using, and the location for all the code, let’s
get started on your Entity Framework Core learning journey!
Thank you for reading my book, and I welcome any comments
and feedback at [email protected] .
Table of Contents
Chapter 1:Introducing Entity Framework Core
Supported Databases
High-Priority Features
NuGet Packages
Generating Code
NuGet Packages
Data Types
Relationships (Master-Detail)
Random documents with unrelated
content Scribd suggests to you:
Molded Polystyrene Resins.
Source: Bakelite Corporation, 247 Park Avenue, New York, N. Y.
1 Not available.
2 Preliminary.
1 Invoice analysis of imports entered through the New York customs district.
1 Analysis of invoices of imports entered through the New York customs district.
2 Imports from Germany under statistical classification 817.58 (par. 2), vinyl
acetate, polymerized, and synthetic resins made in chief value of vinyl acetate.
3 Preliminary.
Aniline resins.
Resins obtained by condensing aniline and formaldehyde have
been developed in recent years. Much of the research on this type of
resin was done in Switzerland by the Ciba Co., which holds a
number of patents on it. The Swiss product, called Cibanite, has
excellent electrical and mechanical properties. At least one domestic
manufacturer is licensed under the Swiss-owned patents.
Diphenyl resins.
A series of products known as Aroclors and made by chlorinating
diphenyl are available in commercial quantities.
Diphenyl was commercially produced for the first time by Swann
Research, Inc., at Anniston, Ala., about 1928. The demand for it as a
heat-transfer medium resulted in large scale output. Later it was
found that certain of the chlorinated compounds of diphenyl possess
valuable resin properties.
The Aroclors range from a clear mobile oily liquid to an amber
colored transparent solid. They are thermoplastic, do not polymerize
or oxidize, and are therefore nondrying. They may be dissolved in
varnish oils, such as tung oil and linseed oil, to give varnishes which
are resistant to alkali and water. The diphenyl resins are good
adhesives on metal and glass and give strong joints between such
surfaces. They have a high dielectric constant, resistivity, and a low
power factor. Their chief use is in wire insulation.
The domestic production of chlorinated diphenyls is, at present,
solely by the Monsanto Chemical Company, St. Louis, Mo.
Furfural resins.
Large scale commercial production of furfural, an aldehyde
obtained from oat hulls and other farm waste, has made it available
for synthetic resin manufacture.
Tar-acid furfural resins possess certain outstanding properties,
such as great dimensional accuracy, great reaction speed to the
infusible solid stage, and unusual strength and toughness. They are
available in dark shades only. Printing plates as large as those of
metropolitan daily papers are molded from them as are radio tube
bases, all sorts of electrical parts, and machined parts requiring
great dimensional accuracy. Other uses are in abrasive wheels,
varnishes, and adhesives.
Probably the largest domestic maker of furfural resins is the Durite
Plastics Division of Stokes and Smith Company, Philadelphia, Pa.
Sulphonamide resins.
The sulphonamide resins were developed from para
toluenesulphonamide, a byproduct obtained in the manufacture of
saccharin (synthetic sweetening agent).
Para toluenesulphonamide, condensed with formaldehyde or other
aldehyde, forms a viscous mass which, on heating, is converted to a
hard colorless resin. Such resins are compatible with cellulose
acetate or nitrocellulose in lacquers, the combination yielding clear,
colorless lacquers of good gloss and adhesion. Other possible uses
are as an adhesive in safety glass, in certain molding compositions,
in insulating materials, and to deluster artificial silk.
Domestic production of sulphonamide resin is entirely by the
Monsanto Chemical Co., St. Louis, Mo. It is marketed under the
trade name Santolite.
12. ORGANIZATION OF THE
SYNTHETIC RESIN INDUSTRY
The discussion of the various synthetic resins on pages 11 to 52
carries in each case, under the heading of production, a notation of
the number of companies producing that particular resin; and the
discussion on pages 86 to 141 of important raw materials for these
resins describes briefly the conditions under which these materials
are produced. We shall now consider the interrelationships between
industries producing the several resins, and the relation of the resin
industries to their raw materials and to some of the important resin-
consuming industries.
No description of the organization of a rapidly expanding industry
can be expected to remain accurate for long. But regardless of future
changes that may be expected, the general pattern seems definite
enough to make possible a few broad generalizations. At present the
producers of synthetic resins may be classified in two groups: those
making alkyd and tar-acid resins, and those making all other
synthetic resins.
The alkyd resins and the tar-acid resins are produced in large
volume, and for these resins the patent situation is such that there is
nothing to exclude new producers. The result has been that new
firms have entered the field and there has been a marked tendency
for concerns using these resins on a large scale to produce them.
This general situation may be expected to continue as long as the
volume of consumption of these resins is rising. But when
consumption levels off, it would not be surprising if increased
competition for new business resulted in consolidations of some of
the producing units.
Each of the other synthetic resins is produced by a small number
of firms and this may be expected to continue as long as the
production of a particular resin is small, or basic patents dominate
the situation. When and if the situation in these respects changes for
some of the other resins, they will probably develop the same
tendencies as now exist in the production of the tar-acid and alkyd
resins.