justnbusiness entities

In case you hadn’t noticed I used NBusiness as the backend for this very site. Well due to popular demand I am including the entities I used to create this very site as well as the sql scripts for the custom factory methods. Feel free to build your own blog with this code! I’ll probably make another post related to how to roll out changes to your goddaddy (or other web host) relatively easily using an “install” system.
Download the Entity Project here.
All you need to do is install the latest version of NBusiness. Add a reference to this entity project and build your code. You can use the sql scripts generated by NBusiness (or run the schema updater by right clicking the project file in the solution explorer) then run the custom sql script included with this project.

Spark view engine

If you’re interested in the new Microsoft MVC framework but you’re a little skeptical about going back to a classic ASP Tag Soup rendering system, you should check out the Spark View Engine.

It has a very interesting way of allowing you to write your view with some simple string replacements and also specialized tags that appear to be actual HTML. The general idea is basically the same but visual appeal is quite a bit better.

Here is an example:

<var names=“new [] {‘alpha’, ‘beta’, ‘gamma’}”/>

<for each=“var name in names”>

  <test if=“name == ‘beta'”>

    <p>beta is my favorite.</p>


    <p>${name} is okay too I suppose.



 In this case your “foreach” loop appears to actually be part of the html. The code inside of the each attribute is compiled as C#.  The system it uses is pretty straightforward and easy to understand which gives me a lot of confidence in it already.

I have been having problems getting NVelocity to work properly so I am going to try to use Spark as the default NBusiness code generation tool. We’ll see how intuitive it is to have this pseudo-html markup inside of code but I suspect this tool will work much better for NBusiness.

Jeff Perrin on Obscuring HTTP

I was reading an article by Jeff Perrin about how ASP.NET attempts to abstract web development and came across this phrase:

Now the first problem with Webforms is not that it’s an abstraction, or even that it’s a leaky one (they all are). The problem is that what Webforms attempts to abstract away is actually simpler than the abstraction!

The second “problem” with Webforms is that not very many people know the first problem. I know I didn’t, until I saw how Rails, Monorail, and other frameworks are able to work with the underlying model of the Web, while still being terribly simple to understand and develop on top of. Making it easier to program for the Web is a laudable goal, I’m just not so sure that abstracting the technology that it’s built on top of to the point where it’s unrecognizable is the way to go about doing it.

To me this rings very true. I have been following the progress of the Microsoft MVC framework a lot lately and I can’t tell you how excited about it I am. It will be a giant relief to finally be rid of postbacks and viewstates!

Upgrading to NBusiness 2.1

I finally spent some time last night updating this blog site. I still have a few things that I want to do but I got some of the big things out of the way. The first big one was upgrading to NBusiness v2.1, actually it was pretty easy to do but I wasn’t sure how it would work out.

For anyone out there running 2.0.1 and thinking about upgrading to 2.1 I’ll try to list some issues you are bound to encounter. The first one is the change from using the static CreateNew() method to using constructors. so if you have code like this:

Blog blog = Blog.CreateNew();

You will need to change it so that it looks like this:

Blog blog = new Blog();

Much better if you ask me! Also the old create new methods will still be generated but it will give you an obsolete error message so you can find and change them easily. You may also have to change references to NBusiness in your website, i had to alter a web.config file that had version information in it. Other than that I had to run the sql stored procedures it created on my new site to get it to work which is fine.

Also there is one big problem I encountered and that is that the scripts will generate sibling relationship tables and scripts and keys at the bottom of “complete.sql” not at the top with the rest of the tables! Which means if you try to run just the scripts be sure to search for ALL of the table drop/create scripts because I accidentally dropped my BlogsTopics tables when upgrading. Which turned out to be ok because I wanted to redo them anyway (I had too many useless topics) but it could have been really bad in a bigger site.

I’ll probably make NBusiness v2.1 available as the primary download on codeplex later today (you can get it right now from the planned release section).

The biggest new feature of NBusiness 2.1 is the ability to use some generated objects to create dynamic sql. So when you go to create custom fetch methods its much faster than the current system. The other features are listed on the download page.

Godaddy and HttpModule Problems

I just had an issue rolling out an HttpModule to my godaddy site (this site). I have a custom URL rewriter that I use to convert urls for blogs and topics by title into a common handler. For example the path:
Will actually just be routed to the URL:
It’s prettier that way and then I only need one page to serve up all of the blogs BUT I had some major problems rolling it out. I had no idea why though, it worked great on my test site but then I rolled it out to Godaddy and it just didn’t work. So I did what any other developer would do and I search Google high and low for about an hour. After a while I finally found a tidbit related to the default file for a given site and how if it was, say, index.html than if you had url’s that didn’t specifically have an .aspx on the end then IIS wouldn’t even try to use ASP.NET but would instead just try to serve up the raw pages! This is what I was doing and once I added the .aspx to the above URL’s and my rewriter then suddenly it worked, the server would hook into my custom URL rewriting HttpModule and everything was dandy!