Databases Reference
In-Depth Information
FIGURE 2.5 Entity Designer and Properties windows.
The Entity Designer automatically creates a C# file (or Visual Basic file, depending on the
type of project you are using) that Solution Explorer hides under the EDMX file. This file
contains classes generated from the entity data model, such as the Product entity in this
example. After a major cleanup to improve readability, it can be boiled down to the
following pseudo-code:
public partial class Product : EntityObject
{
public int ProductID { get; set; }
public string ProductName { get; set; }
public int? SupplierID { get; set; }
public int? CategoryID { get; set; }
public string QuantityPerUnit { get; set; }
public decimal? UnitPrice { get; set; }
public short? UnitsInStock { get; set; }
public short? UnitsOnOrder { get; set; }
public short? ReorderLevel { get; set; }
public bool Discontinued { get; set; }
}
Notice that the Product class closely resembles the Products table it represents. It has prop-
erties, such as ProductID and ProductName , with names and types closely matching those
of the database columns. However, unlike the Products table, the Product class encapsu-
lates a single row and not the entire table.
 
Search WWH ::




Custom Search