The only thing I could find about enum support in breeze.js is this feature suggestion on uservoice, which was recently marked as closed in 0.82.
I’m using currently latest, 0.84.3.
UPDATE:
I’m using code first in EF 5.0.0 with .net 4.5. When starting application and breeze makes request for metadata, EF creates empty database and my enum property is in database as int, so that part is ok.
However, when I added an enum property to my model, I got exception when breeze tried to parse metadata:
Uncaught Error: Unable to locate an 'Type' by the name: ItemType:#TestApp.Models breeze.debug.js:5051
getTypeFromMap breeze.debug.js:5051
ctor.getEntityType breeze.debug.js:5028
ctor._updateProperty breeze.debug.js:6056
ctor._fixup breeze.debug.js:6133
ctor._fixup breeze.debug.js:6132
ctor.addEntityType breeze.debug.js:4702
convertFromODataEntityType
This is my model (simplified):
public enum ItemType
{
Ordered,
Approved,
Misc
}
public class Item
{
public long Id { get; set; }
public ItemType Type { get; set; }
}
Where am I making mistake? Is there working sample with enum?
I just tried adding your ItemType enum to one of our models ( the ToDo model in the breeze DocCode sample) without a problem.
I am not sure what you are running into. So two suggestions,
1) Try updating (hack) the DocCode sample that ships within the breeze samples zip to use your ItemType enum ( details below) and then run any of the basic ToDo tests.
or
2) Send me (Jay Traband) a stripped down version of your project at breeze@ideablade.com.