Blinq - changing your applications one database at a time
Last week, the ASP.Net team released the 'Blinq' prototype to the web. There has been a fair bit of buzz around this which is slowly but surely growing. Scott Guthrie's sneak preview at TechEd 2006 helped! One of the first questions I get asked is - why 'BLINQ' - I write this in caps so that people do not confuse it as 'BLING' - written in small letters Blinq / Bling - look sort of similar. Well the prototype was named Blinq instead of 'Automatic Web Form Generation Tool' because, well now you know why :) - it also springs upon you, subtly, the idea that the work is done in the 'blink' of an eye, and the fact that it follows patterns of Blog (Web log) as to Blinq (Web LINQ). So now that we have gone past the naming conventions, on to some of the cool things that Blinq can do for you.
Blinq is a tool for auto generating web forms, for displaying, manipulating and creating data, based on the database schema. Blinq also adds sorting and paging capabilities, alongwith functionality for navigating foreign-key relationships. The code that Blinq generates can be easily customized to fit particular needs and thus it gives a useful starting point to build a data-driven application.
One of the first thing to notice is that Blinq builds on top of ASP.Net 2.0 and requires the May LINQ CTP to function. The installer puts files under '\Program Files\Microsoft ASP.Net\Blinq' [for x86] and '\Program Files (x86)\Microsoft ASP.NET\Blinq' [for x64] and this is the pace to get started. The readme file at this location also provides start up documentation and some known issues - if you run into issues which are not documented - do post them here for help from the product team. Also I would like to exhort everyone to post suggestions they might have on improving the experience. Too much talk, let's get into some action - the first thing to do is Open a command prompt and after navigating to the Blinq install dir - type the 'blinq' command - this provides you a list of possible options that you can supply to blinq
The most basic command that can be run would look something like
'blinq /t:\myApp /database:myDatabase /server:myServer' - this would create an application at '\myApp' using the myDatabase as the backend which resides on 'myServer' Sql server. At this point if you check out the \myApp directory you would see aspx pages - 3 per table in the database [1 for inserting data, 1 for select/edit/delete, 1 for viewing details], one thing to note is that if any table in your database doesn't contain a primary key then these pages will not be generated for the table. You can also use the '/dataBaseFile' option on the command line instead of the '/database' option to go against a Sql Server Express database. You can also define the '/vDir' option if you wanted to create a website in IIS for the application - this also launches IE after running the command and displays the default page which contains links to the starting pages for all tables in the database. You can also use the '/pageDatasource' option which adds the methods to access data to your page code file and makes them more localized to your aspx page. Blinq provides inbuilt paging capabilities - with the paging happening on the SQL server and thus helps in handling large tables in a performance capable way. Blinq also provides automatic linking of foreign key relationships. It also privdes for optimistic concurrency during updates and the columns that participate in the OC can be fine tuned.
There have been multiple blogs posts around the usage of Blinq and thus I will not go into too much details. If you have any questions / comments - please do let me know.