Is there a way to create typed entities using Breeze in the same way that JaySvcUtil works for JayData? Does this include Typescript support - also is there general Typescript support within the Breeze framework?
This gist contains a modified version of T4TS that contains some initial support for generating "design time Javascript classes for each entity" with support for Breeze.
https://gist.github.com/alexdresko/5393155
So far, it suits my needs. I'm pretty sure you need to have the DefinitelyTyped Breeze definition in your solution for this to work properly.
Maybe this is something that could be added to T4TS permanently? Maybe it's something for the Breeze team to consider? Or maybe it's just stupid and doesn't really work for anyone but me. :)
In my dataservice, I can do something like:
createOrganization() : T4TS.Organization {
return <T4TS.Organization>this.manager.createEntity("Organization");
}
Then, in my VM, all of this code is nicely typesafe..
organizationSubmit() {
this.editingOrganization(false);
var newOrganization = this.dataservice.createOrganization();
newOrganization.Name(this.organizationNameInput());
if (newOrganization.entityAspect.validateEntity()) {
this.extendOrganization(newOrganization);
this.organizations.push(newOrganization);
this.dataservice.saveChanges();
this.organizationNameInput("");
} else {
this.handleItemErrors(newOrganization);
}
};
I don't really know where to go with this from here. I tried forking T4TS, but didn't have time to figure out his build system. Hence the gist. Opinions are certainly welcome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With