Please read the blog post Generating a fully RESTful Api and UI from a database with LLBLGen and ServiceStack to learn more about this project.
A set of LLBLGen Pro templates to generate a fully RESTful ServiceStack API and HTML interface to manage domain entities.
- Demo site: http://northwind.mattjcowan.com
- Themed demo site: http://northwind.mattjcowan.com?theme=enterprise
- Blog posts:
For all examples below, you may want to use Chrome or a browser that can show you JSON results (IE tends to force a download of json files, or use Fiddler). Chrome is nice in the sense that it always displays the reponse from the server, regardless of status code (200, 400, 401, 404, 500, etc...) and regardless of the content type (JS, XML, etc...).
- Upgraded ServiceStack References: from 3.9.38 to 3.9.54
- Added Theming Capability for Razor Views: by enhancing the RazorFormat class (works for view pages, content pages and razor handlers)
- Blog Post: Theming ServiceStack Razor Views
- Added SQL Resultset Caching to V4 templates: use a new rcache querystring parameter to identify the number of seconds you wish to cache resultsets for (use 0 to force cache refresh, uses LLBLGen Resultset Caching)
- DataTable implementation enhancement: now when adding/removing columns in the UI, you are truly only fetching the columns being displayed from the database
Added support for Typed Views and Typed Lists (for both LLBLGen 3.5 and 4.0, and using ServiceStack v3.9.38).
- New blog post: RESTful Api and UI for Typed Views and Typed Lists with LLBLGen and ServiceStack
- New demo of typed view browser: http://northwind.mattjcowan.com/views
- New demo of typed list browser: http://northwind.mattjcowan.com/lists
- Previous demo of entity browser: http://northwind.mattjcowan.com/views
Added a new LLBLGen Preset and some additional templates to make the project compatible with the newly released LLBLGen V4 release.
If you are using LLBLGen V4, please pick the "MJC.Presets.Adapter.ServiceStack.V4" preset when generating the code.
The goal for this release was to give developers working with these templates and the generated code a means to further extend the code without impacting the code generation process and future releases of the templates.
Please use the "Issues" section of the GitHub project to file desired enhancements and/or point out issues with the code.
-
Primary Key and Unique Constraint requests now respond with a 404 status and a clean response for non-existent records
Example: two sample responses for non-existent categorie (PK and UC)
-
Added simple validation to the auto-generated services, for all CREATE/UPDATE/DELETE methods The validation gathers up the errors and sends them back with the response.
Example: The following code is in response to a DELETE request with an invalid category id at URL: /categories/0
{ "responseStatus" : { "errorCode" : "ValidationException", "errors" : [ { "errorCode" : "GreaterThanOrEqual", "fieldName" : "CategoryId", "message" : "'Category Id' must be greater than or equal to '1'." } ], "message" : "Validation failed: \r\n -- 'Category Id' must be greater than or equal to '1'.", "stackTrace" : null }, "result" : false }
-
Added partial methods throughout the generated code allowing anyone the ability to easily customize the code using partial classes
-
Added LLBLGen user regions throughout the generated code allowing developers to easily add bits of code where needed to extend existing functionality
-
Added some new settings in LLBLGen designer to specify where the Authenticate attributes should be generated
- You can observe these settings by navigating to Project > Settings > LLBLGen Pro Runtime Framework > ServiceStack
-
Cleaned up XML output (nice and tidy now :-))
Example: sample XML to see the tidy output
-
Introduced a new parameter "limit". When using "limit", disregard the paging object in the response, it does not apply at this time.
Example: Fetch first 15 customers (paging and limits are mutually exclusive, paging trumps the limit parameter)
-
Introduced deep fetching with max limits within subpaths (no imposed depth boundaries)
Example: Fetch categories with ID = 1, and include 3 related products, and 2 related order details per product, as well as each supplier for each product /categories?filter=categoryId:eq:1&include=products:3.orderdetails:2,products.supplier (xml, json)
-
Restricting which fields are fetched no longer just on root item but also related items
Example: Simple query without selecting fields, vs query WITH field selections on related items
/categories?filter=categoryId:eq:1&include=products.supplier,products.orderdetails:3.order (xml, json)
/categories?filter=categoryId:eq:1&include=products.supplier,products.orderdetails:3.order&select=products.orderdetails.order.customerid,products.orderdetails.quantity,categoryid,products.productname,products.supplier.companyname (xml, json)
-
Introduced basic relation queries (adding filters on sub-related items)
Example: All products where the supplier is from Japan
/products?filter=(^(supplierid:neq:14)(categoryid:neq:4)(supplier.country:eq:japan))&include=supplier (xml, json)
Example: You don't have to include the item that your are filtering, see below:
/products?filter=(^(supplierid:neq:14)(categoryid:neq:4)(supplier.country:eq:japan)) (xml, json)
Example: all products sold (that have shipped orders) on the 4th and 5th of July, 1996
/products?filter=orderdetails.order.orderDate:bt:"07/04/1996":"07/05/1996" (xml, json)
- Demo site: http://northwind.mattjcowan.com
- Blog post: Generating a fully RESTful Api and UI from a database with LLBLGen and ServiceStack
- Add relationship aliasing and join type clauses,
- Be able to filter included items down (not just limit) in response (for example return products and orderdetails and orders, but only those orders where the quantity sold was greater then 30)
- Be able to support aggregates (MAX, MIN, SUM, COUNT) and grouping clauses