BreezeJS support? #14

Closed
alexdresko opened this Issue Apr 16, 2013 · 5 comments

Comments

Projects
None yet
3 participants

I made some very simple modifications to the T4TS.tt file in my solution so the generated enties better support BreezeJS. You can see my full T4TS file at https://gist.github.com/alexdresko/5393155 and a potentially helpful explanation for my madness at http://stackoverflow.com/questions/13817230/breeze-js-typed-entities/16028385#16028385.

I'm interested to know what you think about this idea as being an actual feature of T4TS, perhaps by way of an additional attribute like TypeScriptInterfaceAttribute.. maybe TypeScriptBreezeInterfaceAttribute?

Owner

cskeppstedt commented Apr 16, 2013

Hello @alexdresko,

First of all, yes, the way I'm actually building the .tt file right now is extremely manual, I'm thinking of some way to automate this to make it easier for others to contribute to the project. I'm definitely ashamed that I haven't got around to fix that yet.

I am not familiar with BreezeJS actually, but I downloaded your gist and looked at the generated .d.ts-file. It seems that a getter/setter function for each property and an extends breeze.Entity for each interface is pretty much what you would like?

I have thought about some general way of abstracting the code generation. I reckon that it could be useful for other JS frameworks as well (for instance knockout, if you use the ko.mapping plugin). I haven't really come up with a perfect solution yet, but another interface attribute, such as TypeScriptBreezeInterfaceAttribute as you mentioned, and a code generator that is aware of how to format code for this type of interface, could definitely be the correct way to go.

This all sounds great! You're right about the changes I made, but I'm definitely not enough of a Breeze expert to know all of the modifications that a TypeScriptBreezeInterfaceAttribute should make. Hopefully we'll hear more from the community on the subject.

One thing I failed to mention is that the modifications I made are actually to support both Breeze AND (at least partially) Knockout. Perhaps a final solution would require creating both a Breeze and a Knockout attribute for T4TS. My brain starts to spin a little when I think about fully supporting Breeze and Knockout at the same time though because I know TypeScript doesn't support multiple inheritance.

As a side note, I don't know that there's anything necessarily wrong with how you've structured the T4TS solution. If it works, it works. :)

jmackay commented May 20, 2013

Is using @alexdresko 's files still the best way to go for breeze support?

It has worked for me so far, but it has since fallen a couple of releases behind T4TS, I believe. I'd really love if @cskeppstedt could provide some official integration as mentioned in his original reply. I'd gladly help if I knew the best place to start.

Owner

cskeppstedt commented May 21, 2013

Hey guys, yeah It's my plan, unfortunately I haven't found the time to focus on this yet. In the meantime, go with @alexdresko's way, and I hope I'll get around to actually come through with this soon!

cskeppstedt closed this Apr 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment