Breeze / breeze.server.net

Breeze support for .NET servers
MIT License
76 stars 62 forks source link

Any plans for Typescript Definition generator for the Breeze dbcontext? #39

Closed justin-romano closed 8 years ago

justin-romano commented 8 years ago

For .net it would be really great to an a typescript adapter on the server that creates .d.ts files and places them in a folder of your choice. (Development mode only of course) So it happens like a the metadata but the the adapter would write the definition to a files to a path of your choice I did this thing to write out metadata so i could cache it. But a similar thing could be done with the .d.ts files.

    internal static void WriteContextMetadata<CONTROLLER>(string name) where CONTROLLER : IMetaController, new()
        {
            var metadata = new CONTROLLER().Metadata();

            // construct the filename and runtime file location
            var fileName = HostingEnvironment.MapPath("~/meta/" + name + "Metadata.js");

            // the same pre- and post-fix strings we used earlier
            string prefix = "window." + name +  "BreezeMetadata = JSON.stringify(";

            const string postfix = ");";

            // write to file
            using (var writer = new StreamWriter(fileName))
            {
                writer.WriteLine(prefix + metadata + postfix);
            }
        }

But have the actual types would be stupefyingly awesome.

steveschmitt commented 8 years ago

We have that already! Check out the breeze.tooling repo. There's a tool to generate TypeScript files from the entities defined in the metadata

justin-romano commented 8 years ago

Bugger and I just wrote it. On 17/05/2016 9:46 am, "Steve Schmitt" notifications@github.com wrote:

We have that already! Check out the breeze.tooling https://github.com/Breeze/breeze.tooling repo. There's a tool to generate TypeScript files from the entities defined in the metadata

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/Breeze/breeze.server.net/issues/39#issuecomment-219558299