0.3.0-build.3 • Published 7 years ago

breezets-lib v0.3.0-build.3

Weekly downloads
107
License
-
Repository
github
Last release
7 years ago

BreezeTypedefExtractor

Visual Studio extension generating and managing typed references to Breeze data service.

A typed Breeze reference can be used as follows from Typescript:

var t = 
  new OrdersServer("https://...")
  .Customers
  .where(cust => cust.Orders.any(order => order.delDate.after(Date.now)))
  .execute();

And the above is fully typed - giving you Intellisense, and compile-time checking of field names, types, comparison operators, etc.

See the Features section below.

Installing

The easiest way to install is to install the Visual Studio extension (see below).

If you're not using Visual Studio (or Windows, for that matter), you can still install a command-line tool using NPM

Installing the Visual Studio Extension (VSIX)

Installing using NPM

Using

Using from Visual Studio

  • Determine the metadata URL of the Breeze data service you want to reference (test it by typing it into a browser - it should return a JSON string starting with '{"schema":{"namespace":...')
  • Start Visual Studio
  • Create a project supporting Typescript, or open an existing one
  • Right-click the project node in the Solution Explorer, and choose "Add a Breeze reference...": img
  • In the dialog box that opens, type in the Metadata URL you determined earlier, and click OK ing
  • After downloading metadata from the URL you supplied, a reference will be added under "Breeze references": img
  • You are now ready to start using the reference: img

Features

Now you can write strongly typed queries against a Breeze data service:

var salesServer = new OrdersServer("https://sales.internal.acme.com:10265/orders");
salesServer
  .Orders
  .where(order => order.shipped == false)
  .and(order => order.estimatedDelivery.before(new Date(2016, 12, 31)))
  .execute()
  .then(
      pendingOrders => 
      {
        var pendingRevenue = pendingOrders.sum(order => order.total);
        if (pendingRevenue > 1000000)
          // alert delivery dept.
      }
    );

This doesn't look too different from the out-of-the-box Breeze queries - until you make an error (type 'Oders' instead of 'Orders') or forget what that field was called ('estimatedDelivery' or 'plannedShipping'?).

Strongly typed

If you mistype 'Orders', you'll get a Visual Studio error-indication:

img

and of course an error message:

img

This also extends intothe queries themselves:

img (for .and(order => order.estimatedDeliveryCost.before(new Date(2016, 12, 31)))

###Intellisense

The strongly typed query interface will also enable Visual Studio Intellisense.

For instance, if you're in doubt about the name of that shipping date field:

img

0.3.0-build.3

7 years ago

0.3.0-build.2

7 years ago

0.3.0-build.1

7 years ago

0.2.14-build.24

7 years ago

0.2.14-build.23

7 years ago

0.2.14-build.22

7 years ago

0.2.14-build.21

7 years ago

0.2.14-build.20

7 years ago

0.2.14-build.19

7 years ago

0.2.14-build.18

7 years ago

0.2.14-build.17

7 years ago

0.2.14-build.16

7 years ago

0.2.14-build.15

7 years ago

0.2.14-build.14

7 years ago

0.2.14-build.13

7 years ago

0.2.14-build.12

7 years ago

0.2.14-build.11

7 years ago

0.2.14-build.10

7 years ago

0.2.14-build.9

7 years ago

0.2.14-build.8

7 years ago

0.2.14-build.7

7 years ago

0.2.14-build.6

7 years ago

0.2.14-build.5

7 years ago

0.2.14-build.4

7 years ago

0.2.14-build.3

7 years ago

0.2.14-build.2

7 years ago

0.2.14-build.1

7 years ago

0.2.14-build.0

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.6

7 years ago