in a previous post i started to take a quick look at the new BLINQ bits released this week at teched. to recap, essentially the core functionality of BLINQ (i love saying that…they should have named it bling) is to generate a CRUD structure of code and asp.net pages for your data structure. the “inq” in BLINQ is because the code generated uses LINQ. okay, all that aside, let’s start taking a look.
BLINQ is a command-line tool. type BLINQ to see the options. for simplicity comparison sakes for rails, i chose the /noStyle option so it would generate the vanilla-plainjane-nofrills-whiteasmilk scaffold site on my pubs database. yes, i’m using pubs — it’s easy to relate to most and has a simple structure including some foreign key relationships, etc.
for those new to rails (ruby on rails), i’m not going to go through a tutorial, and if you don’t know/care what rails is, then move along, there is nothing to see here. if you know a bit, then here’s a little bit more info to help setup the comparison. after installing rails, you’ll be working with sql server (or sql server express – which is free). to work with sql server in ruby/rails you’ll need want an additional database library for ado to make things a bit easier. you can download it here and read more info about it.
ensure the file (ADO.rb) is located in your
once you have that and after you have generated your rails app go to your database.yml file and modify the configuration. for simplicity sake, i’m only using one configuration type (development) to make things easier, since i’m just experimenting anyway. here’s what my database.yml looks like:
after i have that, i’m ready to go. again for simplicity sake, i’m just using the authors table. so generate a model and a controller for author. here lies my first beef with rails when compared to BLINQ. in rails you have to generate all your scaffolds individually. unless i’m mistaken and there is an uber scaffold command, i like how BLINQ looks at all the data and generates them all for you. *however* it would be nice to specify params maybe…so that i could have utmost flexibility — default generate all, or add an argument option for me to specify the tables. anyhow, i digress…
then in your author controller, change it to scaffold:
class AuthorController < ApplicationController
once that is in place, and you start your WEBrick server, you should be able to browse to http://localhost:3000/author/ and get this:
and therein lies my love of rails scaffolding! a simple, single line in the controller and i have full access to all the features. rails is doing everything behind the scenes. a quick look at my application views folder will show no files…think httpmodule for you asp.netters. i wish BLINQ would implement this — an httpmodule/handler that would allow me to configure the scaffold and then do all the magic goop for me.
here’s my second disappointment with rails scaffolding …there is no default page…i like how BLINQ generates an index page for me so that i can go to the site and then pick the pages i need to play with. even though BLINQ does this for me though, when on a page (i.e., authors), there is no ‘back to index’ link at all…so i rely on the back button too much. now remember i stated earlier that i used the /noStyle option to generate my BLINQ bling. if i hadn’t, then BLINQ *does* generate a skin/theme for me which uses the asp.net menu control and on every page i can see the nav structure. it uses a master page. i think even in the /noStyle option, a master page with a nav structure would be helpful — but i guess /noStyle means “no style” .
okay, so we’ve gotten this going…are you sick of command lines yet?
now let’s look at the functionality of the rails scaffold…want to delete something?:
nice! a confirmation…no confirmation in BLINQ generated UI — that needs to change!
when editing in rails scaffold, it takes you to a singular details screen with an update/back.
in BLINQ, you have inline datagrid editing with update/cancel
damn it — give me a back link here! i have a default/index page, so give me a link back to it!
it should be important to note that i’m calling it rails scaffolding, but technically it is rails in combination with activerecord doing the ruby/rails magic here.
one thing that i think both suck at right now are two key things.
validation: it knows what is required, etc., so why not wire up some validation for me? instead i get goobly-guck error messages (note to our asp.net team: we should use the customErrors and make something nice in the generated page)
foreign key relationships: it doesn’t generate user friendly views of this. take the employees view (shown in BLINQ gen here):
the drop downs are the values of the relationships and don’t portray the user-friendly view of the data…rails generated code is no different. again, we know the relationship…let’s put some more magic in here to make it whiz-bang!
one thing to note is that BLINQ does get it a bit. look below where my cursor is:
there is a link created for titleauthors — which is the relationship on this authors table…so i can directly go to that location. in rails, this isn’t there…
paging: this is a quick one — in rails, it is ‘next page’ and ‘previous page’ (just look at some of the shots above) — so how many ‘next’ pages are there? using the gridview in asp.net gives us numeric paging — done.
one thing that rails understands is plurality. my table is actually called ‘authors’, but you’ll notice the model/controller/etc are authors — it ‘gets it’ and does everything for me (yes, people/person works too). BLINQ doesn’t necessarily have this problem because it is generating specific code for the tables…if the handler/module method was implemented, maybe that could be examined…but for now it is a ‘cool’ feature in rails — not earth shattering, but nice to know if you need it.
for where i think BLINQ misses right now is in some easy hits.
- where’s atlas? why not make all the pages zing with some atlas uber magic? how about an /async option on BLINQ.exe? the CRUD pages scream with pleading for some low-hanging atlas love.
- please put in a delete confirmation
- show me my index link
- linq — this is cool how it uses this…take a moment to examine the code generated…it is pretty fun to look at — the pages using objectdatasources to bind to linq objects…yummy.
anyhow, a quick examination of the two in a few minutes…there are pros and cons to how each generates the respective ‘scaffold’ for their technologies (i’m not arguing the merits of the actual technologies here, just comparing some like implementations of features).
i think that BLINQ will evolve over time, hopefully more for the better — maybe (crossing fingers) BLINQ will be another open source project out of the asp.net team — codeplex anyone?
tags: asp.net, blinq, linq, codeplex, ruby, rails, scaffold