Dot Net Tricks

Articles about .NET, ASP.NET, C#, Object Oriented Programming and Agile Methodologies
Welcome to Dot Net Tricks Sign in | Join | Help
in Search

Thoughts.Generate();

  • Publishing Dreams - A Coding Nightmare

    It's well known that at many developers tend to solve bugs, find solutions to challenges that they're facing during their work week all during the wee hours of the night.  In their sleep!  Some call it extreme excercise for the mind, i'm not one of them.   I find it riduclous that my mind ends up pulling 22 hour days.

    So last night was the absolute worst, not only was I dreaming about problems, but somehow in my dream I believed i had to build and publish my dream before I could wake up!  Whah!?  I had myself convinced in my dreams that my solutions to those problems I was dreaming about would not work unless I built AND packaged the dreams.  When my eyes opened at 6:30, I was shaking my head in disbelief, what the heck am I doing. 

    Publishing my dreams of code, i've gone looney. Tongue Tied [:S]


  • Codesmith Rocks!!!

    Ok, yes, I work for Codesmith!  Let's put that aside for a second, since i've been a huge Codesmith fan long before I became a proud Codesmith Employee, that's what makes my job that much better, because I truly believe in this product 110%!

    It's soo easy to use codesmith that quite honestly, if you're not having Codesmith generate at least 25% of your work, in the future, i'm certain you will wake up one day and realize how much time you could have saved and think of me, ok, maybe not me, but this post Wink [;)].

    Time for a Trick!

    It was asked in the community how to navigate through all of the procedures in a database, so in 10 mins, I have created a nice little stored procedure dumper and explicitly used only the SchemaExplorer API, to show how to use as much of it as possible.

    <%-- 
    Name: CommandDumper.cst
    Author: Robert Hinojosa
    Description: Dumps the essentials of all of the stored procedures in a given database.
    --%>
    <%@ CodeTemplate Language="C#" TargetLanguage="Text" Src="" Inherits="" Debug="False" Description="Template description here." %>
    <%@ Assembly Name="System.Data" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Assembly Name="SchemaExplorer" %>
    <%@ Assembly Name="System.Design" %>
    <%@ Assembly Name="SchemaExplorer.SqlSchemaProvider" %>
    <%@ Import Namespace="SchemaExplorer" %>
    <%@ Import Namespace="System.Collections" %>
    <%@ Import Namespace="System.Text" %>
    
    <% 
        
        // You can also just use a DatabaseSchema property to set all this stuff through the property grid.
        // I'm doing this to show how it can be done programatically
        string connectionString = "server=(local);database=Northwind;Integrated Security=true;";
        SchemaExplorer.SqlSchemaProvider provider = new SchemaExplorer.SqlSchemaProvider();
        DatabaseSchema db = new DatabaseSchema(provider, connectionString);
        
        Response.IndentLevel = 1;
        Response.WriteLine("Database Name:", db.Name);
        string currentCommand = "";
        string currentCommandProc = "";
        string exceptionMessage = "\n\n//TODO: I can't create sql objects when doing discovery, please skip me.{0}\n\nException:\n{1}\n\nProcedure: \n{2}";
        string generalException = "\n\n//TODO: An error occured. {0}\n\nException:\n{1}\n\nProcedure: \n{2}";
        
        try
        {
            //Loop through the Procedures
            foreach(CommandSchema proc in db.Commands)
            {
                try
                {
                    Response.IndentLevel = 2;
                    currentCommand = proc.Name;
                    currentCommandProc = proc.CommandText;
                    
                    //Loop through all input params, you would probably iterate through all of the output params as well.
                    StringBuilder sb = new StringBuilder();
                    for(int i=0;i<proc.AllInputParameters.Count;i++)
                        sb.AppendFormat("{0},", proc.AllInputParameters[ i ].Name);
                        
                    Response.WriteLine("- Procedure Name: {0} - Params: {1}", proc.Name, sb.ToString().TrimEnd(','));
                    
                    int idx = 0;
                    //Since a procedure can have more than 1 result set, display them all
                    foreach(CommandResultSchema result in proc.CommandResults)
                    {
                        idx++;
                        Response.IndentLevel = 3;
                        Response.WriteLine("+ Returned Result Set #: {0}", idx);
                        
                        //iterate through columns of result set and their type
                        foreach(CommandResultColumnSchema column in result.Columns)
                        {
                            Response.IndentLevel = 4;
                            Response.WriteLine("* Name: {0} - Type: {1}({2})", column.Name, column.NativeType, column.Size);
                        }
                    }
                }
                catch(Exception exc)
                {
                    //Things such as temporary tables aren't good for discovery since codesmith isn't actually executing the proc, 
                    //That object does not exist, and usually an exception is thrown.
                    //Consider using in memory Table Variables instead.  
                    Response.WriteLine(exceptionMessage, currentCommand, exc.ToString(), currentCommandProc);
                }
            }
        }
        catch(Exception exc)
        {
            Response.WriteLine(generalException, currentCommand, exc.ToString(), currentCommandProc);
        }
    %>
    

     

  • Telerik Sitefinity, a CMS actually worth talking about

    I was recently in the market for a good CMS based on .net with my last employer. I was delightfully surprised to find Telerik's Sitefinity.  Telerik has this slogan which I just really love, "Deliver more than expected!".  Now that's the kind of driver I'm talking about.  This is a company that actually stands behind their slogan, and continues to really drive innovation in the developer tools market.  Don't get me wrong, they're not the only big fish in this area, but I really think they're leap from a controls only platform to a suave CMS, has really "kicked it up a notch" outdoing their competition.

    Reasons you should look into this product:
    * If you get a license, you get to use all of their awesome controls with it as well. So, really, the CMS is just an extra topping of goodness.
    * Their pricing is extremely reasonable, especially for their offering, and the usage of their controls.
    *  They take a well thought out take on what a CMS really needs to be from a developer standpoint:

    • Fit any design
    • Be able to include custom user controls as modules
    • Be able to program to a 1st class API
    • Include the administration of your custom user controls in the same space as the CMS administration
    • Expose the workflow engine to custom code
    • Smart live site editing and manipulation
    • Templated layouts
    • The next version will have true content versioning (gasp, what a concept!)  This has been missing from most affordable CMS systems since the beginning of time.
    • Oh yeah! It's got the best UI i've ever seen for a CMS.

    Now, it's not a perfect product, yet (There's still half a gallon of Kool Aid left in the jug)  Things they need to fix or yet to release:

    • It's still in asp.net 1.1, you can make it work in asp.net 2.0, but it's not optimized to use things such as master pages, which would really help when defining your template layouts.  (Asp.net 2.0 release is coming out in June 2006)
    • Availability of modules, there are several modules that they could offer right out of the box without too much effort and support, blogs, press releases, image gallery, etc.  At it's current state, it's pretty much barebones, the custom modules they do offer are more as examples than actual production ready code.
    • For some reason, they haven't pounded the marketing hammer on this product yet.  It's not nearly as advertised as their Telerik Control Suite, but it all fairness, it's a relatively new product, and I'm sure they are wanting to get the asp.net 2.0 version out first.

    So, if you're in a market for a CMS based on .net give me a shout, as I tested pretty much everything I could get my hands on, I can give you a heads up on competitors products.

This Blog

Post Calendar

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Syndication

Powered by Community Server, by Telligent Systems