Let's consider all the structures that can be created.
Before we start, it would be helpful to take a look at the mappings between .NET types and SQL Server column types. You remember that there is a distinct mismatch between the two, which is one of the problems that Entity Framework strives to fix. You can also find similar mappings between .NET and other RDBMSes, such as Oracle. In this book, we will concentrate on SQL Server. It is not always important to keep these mappings in mind. For example, if you define a property in .NET as integer
, you can safely assume that Entity Framework will handle the column's definition and use the appropriate type; for example, int in SQL Server. Here are the mappings for the most commonly used .NET types:
SQL Server Database type |
.NET Framework type |
---|---|
|
Int64 |
|
Byte[] |
|
Boolean |
|
DateTime |
|
DateTimeOffset... |