How can we improve Breeze.js?

Support evaluation of custom Annotations for Enums through the meta data

If I crete an "advanced" ENUM on server side, including custom annotations, I would like to be able to use that ENUM at client side without redefining it there. Following method can be used to automatically create enums on client side as global variables. In addtion to that I would like to be able to evaluate annotation metadata of the ENUMS to transfer the data that is given by my custom Annotations.


.then(function(data) {

//create global ENUMs from breeze meta data

var enumTypes = data.schema.enumType;
var size = enumTypes.length;

if (size == null) {
} else {
ko.utils.arrayForEach(enumTypes, createGlobalEnum);

function createGlobalEnum(enumDefinition) {

var globalEnum = {};
var enumName =;
var enumMembers = enumDefinition.member;
var values = ko.observableArray();
ko.utils.arrayForEach(enumMembers, function(enumMember) {

var memberName =;
var memberValue = enumMember.value;

var member = {
id: ko.observable(memberValue), //= enum index, e.g. 0
name: ko.observable(memberName),
title: ko.observable(language.getValue(memberName))

globalEnum[memberName] = member;



globalEnum.values = values;

window[enumName] = globalEnum;



Enum value with custom annotation:


Also see section "Enums" in


As an alternative to those enums with custom annotations, I could create an entity for each enum. However, this would create an extra table for each enum... which I do not really need .... and those extra entities are still not as nice to use as enums.

The "automatic generation of enums" inclusive view models that can easily be used for enum combo boxes would also be a nice feature of Breeze.

2 votes
Sign in
Sign in with: Facebook Google
Signed in as (Sign out)
You have left! (?) (thinking…)
matameko shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
Sign in with: Facebook Google
Signed in as (Sign out)

Feedback and Knowledge Base