Project Description
A collection of web development tools and frameworks for developing in ASP.NET MVC, ASP.NET classic, DotNetNuke, as well as a DotNetNuke MVC framework.

It does three things very well:
1. Does not translate your SQL, what you write is what's outputted
2. Handles all the parameterization for automatically as your build your statements. (no sql injection attacks etc.)
3. Fills your objects with the return data very simply.

Samples:
SQLHelper.SELECT("ItemId, ItemDate, Description, Hours").
                              FROM("Timesheet").
                              WHERE("PortalId", App.PortalID).
                              AND("UserId", App.UserID).
                              AND("ItemDate", ">", Today.AddDays(-28)).
                              ORDERBY("ItemDate DESC").
                 ExecuteCollection(Of TimesheetItem)()



SQL.INSERTINTO("{{timesheet}}", "PortalId, UserId, ItemDate, Description, Hours").
                       VALUES(App.PortalID, App.UserID, ItemDate, Desc, Hours).
                       ExecuteNonquery()


SQL.DELETEFROM("{{timesheet}}").WHERE("ItemId", ItemId).ExecuteNonquery()


SQL.UPDATE("{{timesheet}}").SET("ItemDate", ItemDate).SET("Description", Desc).SET("Hours", Hours).WHERE("ItemId", ItemId).ExecuteNonquery()


Other Features:
1. INNER JOINS
2. Paged results
3. If you don't find a function to do your specialized sql statement... remember it is just a string builder for sql ... so just jump on the .ADD method and add your sql code as you wish.
4. Caches your object graph so it does not incur the expense of rediscovering your objects when hydrating them.
5. Compact code. It is not an ORM but rather a very productive SQL Builder
6. It does not make you coffee :)

Download it check it out, and if it does not do what you want... simply add a method to to it to handle your scenario... it is supper easy since it uses a jQuery style syntax, your method now becomes available to the builder syntax.

A few more samples and little C# love (SQL is just a convenience property that automatically creates a new SQLHelper class with appropriate ConnectionString for you and returns it):
SQL.SELECT("M.MediaId, Title, Author, Year, Category, Description")
      .FROM("MediaList M")
      .INNERJOIN("Favorites F").ON("F.MediaId=M.MediaId")
      .WHERE("F.UserID",userId).ORDERBY("Title, Year DESC")
      .ExecuteCollection<FavoriteListItem>();


SQL.SELECT("SettingValue").FROM("Settings").WHERE("SettingName", "MaxFileSize").ExecuteScalarString();


SQL.SELECT("C.CourseId, C.Author, C.Year, Number, Name, Description").
       FROM("Courses C").
       WHERE().OpenParenthesis()
                    .LIKE("Keywords",keyword).OR()
                    .LIKE("Name",keyword).OR()
                    .LIKE("ShortDescription", keyword).OR()
                    .LIKE("PrintDescription", keyword).OR()
                    .LIKE("Author", keyword)
                    .OR("Number", keyword)
                 .CloseParenthesis()
       .ExecuteCollection<CourseListItem>();


SQL.SELECT("UserName, FullName").FROM("Users").ORDERBY("FullName").ExecuteCollection<UserListItem>();


Enjoy!

Last edited Jun 18, 2010 at 9:33 PM by MitchL, version 1

Comments

No comments yet.