3

I am using Breezejs with Entity Framework and I have some entities where I added some Non-mapped properties using NotMapped Attribute. Before the latest update of Web API and OData, I was able to do projections on the non-mapped properties but since the last update of Web Api and OData, I am getting an error.

Here are more details.

Lets say I have an entity Order with properties OrderId, Total, etc

To this entity, I added a non-mapped property called OrderDisplayName and added the data annotation attribute [NotMapped].

Now, on the client side, I registered this property with Breeze by doing this

                var type = store.getEntityType("Order");
                if (type) {
                    var mappedOrderDisplayNameProperty = new breeze.DataProperty({
                        dataType: breeze.DataType.String,
                        defaultValue: null,
                        isNullable: true,
                        isPartOfKey: false,
                        maxLength: null,
                        name: "orderDisplayName",
                        nameOnServer: "OrderDisplayName"
                    });


                    type.dataProperties = Enumerable.from(type.dataProperties).where(function (up) {
                        return up.name != "orderDisplayName";
                    }).toArray();

                    type.dataProperties.push(mappedOrderDisplayNameProperty);


                    type.unmappedProperties = Enumerable.from(type.unmappedProperties).where(function (up) {
                        return up.name != "orderDisplayName";
                    }).toArray();
                }

Now, I am trying to do a projection on a couple of properties using Breezejs like this

var query = breeze.EntityQuery.from("Orders").withParameters({ keys: keys}).select("OrderId, OrderDisplayName");


                this.execeuteQueryAsync(query).then(function (promiseData) {

                    var mappings = promiseData.results;

                    });

I keep getting an error from BreezeQueryableAttribute's ValidateQuery method saying

Property named 'OrderDisplayName' cannot find found on type 'Order'.

This used to work fine before I did an update on Odata and Web API (2).

Could someone let me know what I would need to change or if this is a know issue with the update??

Thanks.

Krishna Veeramachaneni
  • 2,131
  • 3
  • 18
  • 24
  • Please see the link http://stackoverflow.com/questions/18898450/breeze-extended-entity-property-only-loads-on-second-query/18919100#18919100 and http://stackoverflow.com/questions/19711752/my-unmapped-properties-in-breeze-does-not-seems-to-work-whith-a-projection – Shohel Aug 25 '14 at 05:35

0 Answers0