1

I'm using breeze.js webapi to expose the class below. I understand the DbGeography type is not supported so I'm using JsonIgnore to remove it from the output, but how do I get it to be ignored/ommitted from the Metadata?

Public Class Household
<Key>
Public Property Id As Integer
Public Property Postcode As String
Public Property Saving As Decimal
<JsonIgnore>
Public Property Coordinates As DbGeography
Public ReadOnly Property Latitude As Double
    Get
        Return Coordinates.Latitude.Value
    End Get
End Property
Public ReadOnly Property Longitude As Double
    Get
        Return Coordinates.Longitude.Value
    End Get
End Property
End Class

<BreezeController>
Public Class HouseholdsController
Inherits ApiController

Private ReadOnly _contextProviders As EFContextProvider(Of EnergyFriendContext) = New     EFContextProvider(Of EnergyFriendContext)

' ~/api/Households/Metadata 
<HttpGet>
Public Function Metadata() As String
    Return _contextProviders.Metadata()
End Function

' ~/api/Households/Households
' ~/api/Households/Households?$filter=IsArchived eq false&$orderby=CreatedAt
<HttpGet>
Public Function Households() As IQueryable(Of Household)
    Return _contextProviders.Context.Households
End Function

End Class

breeze js error:

Unable to recognize DataType for: Edm.Geography 

1 Answer 1

1

Ok, as of breeze v 1.1.1, breeze will no longer throw this exception when encountering an "unknown" DataType.

Data properties with "unknown" data types will now appear within the EntityType metadata with a DataType of "Undefined".

Data returned from the server for any "Undefined" datatypes will be now passed thru raw, meaning the data will be exactly what was serialized on the server, without any breeze processing.

This includes DbGeometry and DbGeography classes for now.

Individual data properties can now be removed from the array returned by the EntityType.dataProperties property.

Removal of a property tells breeze that this property should not be materialized onto any entity of this type when returned to the client. This allows the data for any server side property to be effectively ignored by the client.

Note: it is probably desirable when ignoring a property to also insure that it doesn't get serialized by the server in the first place. I think that you are doing this already.

Hope this helps.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.