You can extend your breeze entities by using the metadataStore.registerEntityTypeCtor
method
In some of my projects I have a separate function to extend each entity.
So you will end up with something like this.
function extendProduct(metadataStore) {
var ctor = function () {
};
var initialiser = function (entity) {
entity.isSelected= ko.observable(false);
return entity;
};
metadataStore.registerEntityTypeCtor('Product', ctor, initialiser);
}
I generally use the initialiser as it gets called after breeze has hydrated the entity by adding all its additional properties etc.
I generally stay away from the contstructor method as it gets called as the very first step in breeze hydrating the entity.