Reputation: 4010
In older versions of breeze when I analyze the breeze metadata file, I'd see a format that shows a detailed json format of metadata that describes the DBContext.
So an example from Breeze's sample would be something like this:
{
"schema":{
"namespace":"Todo.Models",
"alias":"Self",
"annotation:UseStrongSpatialTypes":"false",
"xmlns:annotation":"http://schemas.microsoft.com/ado/2009/02/edm/annotation",
"xmlns":"http://schemas.microsoft.com/ado/2009/11/edm",
"cSpaceOSpaceMapping":"[[\"Todo.Models.TodoItem\",\"Todo.Models.TodoItem\"]]",
"entityType":{
"name":"TodoItem",
"key":{
"propertyRef":{
"name":"Id"
}
},
"property":[
{
"name":"Id",
"type":"Edm.Int32",
"nullable":"false",
"annotation:StoreGeneratedPattern":"Identity"
},
{
"name":"Description",
"type":"Edm.String",
"maxLength":"30",
"fixedLength":"false",
"unicode":"true",
"nullable":"false"
},
{
"name":"CreatedAt",
"type":"Edm.DateTime",
"nullable":"false"
},
{
"name":"IsDone",
"type":"Edm.Boolean",
"nullable":"false"
},
{
"name":"IsArchived",
"type":"Edm.Boolean",
"nullable":"false"
}
]
},
"entityContainer":{
"name":"TodosContext",
"entitySet":{
"name":"Todos",
"entityType":"Self.TodoItem"
}
}
}
}
But now after running this new version of breeze, and hitting my metadata file I see this weird oddity:
{
"?xml":{
"version":"1.0",
"encoding":"utf-8"
},
"schema":{
"namespace":"DBModel",
"alias":"Self",
"annotation:UseStrongSpatialTypes":"false",
"xmlns:annotation":"http://schemas.microsoft.com/ado/2009/02/edm/annotation",
"xmlns:customannotation":"http://schemas.microsoft.com/ado/2013/11/edm/customannotation",
"xmlns":"http://schemas.microsoft.com/ado/2009/11/edm",
"cSpaceOSpaceMapping":"[[\"DBModel.User\",\"Model.User\"]]",
"entityContainer":{
"name":"DBEntities",
"annotation:LazyLoadingEnabled":"true",
"entitySet":{
"name":"Users",
"entityType":"DBModel.User"
}
},
"entityType":{
"name":"User",
"key":{
"propertyRef":{
"name":"Id"
}
},
"property":[
{
"name":"Id",
"type":"Edm.Int64",
"nullable":"false",
"annotation:StoreGeneratedPattern":"Identity"
},
{
"name":"Firstname",
"type":"Edm.String",
"maxLength":"40",
"fixedLength":"false",
"unicode":"false"
},
{
"name":"Lastname",
"type":"Edm.String",
"maxLength":"60",
"fixedLength":"false",
"unicode":"false"
},
{
"name":"Email",
"type":"Edm.String",
"nullable":"false",
"maxLength":"128",
"fixedLength":"false",
"unicode":"false"
}
]
}
}
}
What's the point in including the xml information within the metadata? How is breeze able to pick up information from the metadata between these two versions and still work as it does?
Upvotes: 0
Views: 154
Reputation: 3209
The EFContextProvider (in breeze.server.net) basically just converts the metadata information from EntityFramework from XML to JSON, and sends that back to the Breeze client. The Breeze client knows how to get what it needs from that JSON format, even when there are some extra XML-related bits tacked on.
Basically, Breeze ignores the parts that aren't relevant. In newer versions of EF, the extra stuff in the XML has expanded, but the basic structure has remained the same.
Upvotes: 1