I’m new to SPA and I’m learning it with durandal and breeze. Recently I have switched my solution to Typescript and I’m wondering is there any good solution to generate typed breeze entities in TypeScript basing on EF model on the server. Only thing I have found is this post Breeze.js typed entities but this is only small piece of code and not even a real project. I’m wondering is there any better solution to this issue?
相关问题
- Angular RxJS mergeMap types
- void before promise syntax
- Ignore Typescript errors in Webpack-dev-server
- implementing html5 drag and drop photos with knock
- Entity Framework Code First Migration
相关文章
- Cannot find module 'redux' 怎么解决?
-
EF6 DbSet
returns null in Moq - Entity Framework 4.3.1 failing to create (/open) a
- How to get a Component's own ElementRef for re
- EF6 code first: How to load DbCompiledModel from E
- 'Pick' only refers to a type, but is being
- Why do I need a ToList() to avoid disposed context
- Code-First Add-Migration keeps adding the same col
We are working on this, and don't yet have a released version but soon... Please contact us at Breeze@ideablade.com, if you would like to be on our Beta list for this.
Below is a page you can drop in your site to generate typescript interface definitions. The page fetches the breeze metadata then iterates through all of the types and outputs a typescript interface declaration for each type. The output of this page can then be pasted in any typescript file (*.ts) or typescript definition file (*.d.ts). Enclose the results in a module declaration if you want to namespace the interfaces:
declare module northwind { ... paste interfaces here... }
.Before using the page you'll need to make one edit: change the entity manager's controller url from "api/northwind" to whatever your breeze controller's url is.
The generated interfaces have a dependency on the Knockout.js typescript definitions which you can grab here: https://github.com/borisyankov/DefinitelyTyped/tree/master/knockout/
Using the northwind example from learn.breezejs.com, the output of this definitions generator page would be something like this:
you could then execute a query using breeze and cast the results to an array of employees like this:
below is the definitions generator page- add a new html file to your project named "definitions.html", run the project and navigate to the page.