ASP.NET MVC 3 (二)

Entity framework 

http://msdn.microsoft.com/en-us/library/bb399572.aspx

http://msdn.microsoft.com/en-us/library/bb399567.aspx

  1. Applications can work in terms of a more application-centric conceptual model, including types with inheritance, complex members, and relationships.
  2. Appliations are freed from hard-coded dependencies on a particular data engine or storage schema. 
  3. Mappings between the conceptual model and the storage-specific schema can change without changing the application code.
  4. Developers can work with a consistent application object model that can be mapped to various storage schemas, possibly implemented in different database management systems.
  5. Multiple conceptual models can be mapped to a single storage schema.
  6. Language-integrated query (LINQ) support provides compile-time syntax validation for queries against a conceptual model.

 


SqlClient for Entity FrameworkTypes

 http://msdn.microsoft.com/en-us/library/bb896344.aspx

Provider type name Provider type attributes EDMSimpleType name Facets

bit

n/a

Edm.Boolean

n/a

tinyint

n/a

Edm.Byte

n/a

smallint

n/a

Edm.Int16

n/a

int

n/a

Edm.Int32

n/a

bigint

n/a

Edm.Int64

n/a

float

n/a

Edm.Double

n/a

real

n/a

Edm.Double

n/a

decimal

n/a

Edm.Decimal

 

Facet name Attribute name Value
PrecisionMinimumMaximumDefaultConstant13818False
ScaleMinimumMaximumDefaultConstant0380False

 

numeric

n/a

Edm.Decimal

 

Facet name Attribute name Value
PrecisionMinimumMaximumDefaultConstant13818False
ScaleMinimumMaximumDefaultConstant0380False

 

smallmoney

n/a

Edm.Decimal

 

Facet name Attribute name Value
PrecisionDefaultConstant10True
ScaleDefaultConstant4True

 

money

n/a

Edm.Decimal

 

Facet name Attribute name Value
PrecisionDefaultConstant19True
ScaleDefaultConstant4True

 

binary

n/a

Edm.Binary

 

Facet name Attribute name Value
MaxLengthMinimumMaximumDefaultConstant180008000False
FixedLengthDefaultConstantTrueTrue

 

varbinary

 

n/a

Edm.Binary

 

Facet name Attribute name Value
MaxLengthMinimumMaximumDefaultConstant180008000False
FixedLengthDefaultConstantFalseTrue

 

varbinary(max)

Bb896344.note(en-us,VS.100).gifNote:
This type is not supported in SQL Server 2000.

 

n/a

Edm.Binary

 

Facet name Attribute name Value
MaxLengthDefaultConstant214748364780True
FixedLengthDefaultConstantFalseTrue

 

image

n/a

Edm.Binary

 

Facet name Attribute name Value
MaxLengthDefaultConstant2147483647True
FixedLengthDefaultConstantFalseTrue

 

timestamp

n/a

Edm.Binary

 

Facet name Attribute name Value
MaxLengthDefaultConstant8True
FixedLengthDefaultConstantTrueTrue

 

rowversion

n/a

Edm.Binary

 

Facet name Attribute name Value
MaxLengthDefaultConstant8True
FixedLengthDefaultConstantTrueTrue

 

smalldatetime

n/a

Edm.DateTime

 

Facet name Attribute name Value
PrecisionDefaultConstant0True

 

datetime

n/a

Edm.DateTime

 

Facet name Attribute name Value
PrecisionDefaultConstant3True

 

date

Bb896344.note(en-us,VS.100).gifNote:
This type is not supported in SQL Server 2005 and SQL Server 2000.

 

 

n/a

Edm.DateTime

 

Facet name Attribute name Value
PrecisionDefaultConstant0Flase

 

time

Bb896344.note(en-us,VS.100).gifNote:
This type is not supported in SQL Server 2005 and SQL Server 2000.

 

 

n/a

Edm.Time

 

Facet name Attribute name Value
PrecisionDefaultConstant7Flalse

 

datetime2

Bb896344.note(en-us,VS.100).gifNote:
This type is not supported in SQL Server 2005 and SQL Server 2000.

 

 

n/a

Edm.DateTime

 

Facet name Attribute name Value
PrecisionDefaultConstant7Flalse

 

datetimeoffset

Bb896344.note(en-us,VS.100).gifNote:
This type is not supported in SQL Server 2005 and SQL Server 2000.

 

 

n/a

Edm.DateTimeOffset

 

Facet name Attribute name Value
PrecisionDefaultConstant7Flalse

 

nvarchar

Bb896344.note(en-us,VS.100).gifNote:
This type is not supported in SQL Server 2000.

 

n/a

Edm.String

 

Facet name Attribute name Value
MaxLengthMinimumMaximumDefaultConstant140004000False
UnicodeDefaultConstantTrueTrue
FixedLengthDefaultConstantFalseTrue

 

varchar

Bb896344.note(en-us,VS.100).gifNote:
This type is not supported in SQL Server 2000.

 

n/a

Edm.String

 

Facet name Attribute name Value
MaxLengthMinimumMaximumDefaultConstant180008000False
UnicodeDefaultConstantFalseTrue
FixedLengthDefaultConstantFalseTrue

 

char

n/a

Edm.String

 

Facet name Attribute name Value
MaxLengthMinimumMaximumDefaultConstant180008000False
UnicodeDefaultConstantFalseTrue
FixedLengthDefaultConstantTrueTrue

 

nchar

n/a

Edm.String

 

Facet name Attribute name Value
MaxLengthMinimumMaximumDefaultConstant140004000False
UnicodeDefaultConstantTrueTrue
FixedLengthDefaultConstantTrueTrue

 

varchar(max)

n/a

Edm.String

 

Facet name Attribute name Value
MaxLengthDefaultConstant2147483647True
UnicodeDefaultConstantFalseTrue
FixedLengthDefaultConstantFalseTrue

 

nvarchar(max)

n/a

Edm.String

 

Facet name Attribute name Value
MaxLengthDefaultConstant1073741823True
UnicodeDefaultConstantTrueTrue
FixedLengthDefaultConstantFalseTrue

 

ntext

 

Attribute name Value
Equal comparableFalse
OrdercomparableFalse

 

Edm.String

 

Facet name Attribute name Value
MaxLengthDefaultConstant1073741823True
UnicodeDefaultConstantFalseTrue
FixedLengthDefaultConstantFalseTrue

 

text

 

Attribute name Value
Equal comparableFalse
Order comparableFalse

 

Edm.String

 

Facet name Attribute name Value
MaxLengthDefaultConstant2147483647True
UnicodeDefaultConstantFalseTrue
FixedLengthDefaultConstantFalseTrue

 

Unique

identifier

 

Attribute name Value
EqualcomparableTrue
Order comparableTrue

 

Edm.Guid

n/a

xml

 

Attribute name Value
Equal comparableFalse
Order comparableFalse

 

Edm.String

 

Facet name Attribute name Value
MaxLengthDefaultConstant1073741823True
UnicodeDefaultConstantTrueTrue
FixedLengthDefaultConstantFalseTrue

 


SqlClient for Entity Framework Functions

http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx

http://msdn.microsoft.com/en-us/library/bb399302.aspx

Entity Data Model Tools

 

 

O. R. Mapping http://msdn.microsoft.com/zh-cn/library/cc716779(v=vs.110).aspx

 

 

Together with the Entity Framework runtime, the .NET Framework version 4 includes the EDM Generator (EdmGen.exe). This command prompt utility connects to a data source and generates model and mapping files based on a one-to-one mapping between entities and tables. It also uses a conceptual model file (.csdl) to generate an object layer file that contains classes that represent entity types and the ObjectContext. For more information, see EDM Generator (EdmGen.exe).

Visual Studio 2010 includes rich tool support for generating and maintaining model and mapping files in a Visual Studio application. The Entity Data Model Designer supports creating advanced mapping scenarios, such as table-per-type and table-per-hierarchy inheritance and split entities that map to multiple tables. For more information, see ADO.NET Entity Data Model Designer.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章