BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

August 2006 - Posts

  • New Article on Windows Workflow Rules and Conditions

    If you only look at one feature in Windows Workflow, look at the Policy activity. The Policy activity processes rules. Business rules, game rules - any type of declarative knowledge. Read more in the latest OdeToCode article - "Windows Workflow - Rules and Conditions".

    The Policy activity is easy to use, and provides a boatload of functionality out of the box. You can prioritize rules, and track rule processing in detail. WF provides an API to modify rules at runtime, which provides a great deal of flexibility. Rules execute with forward chaining semantics, meaning the rules engine analyzes the dependencies and side effects of each rule, and can reevaluate rules when the underlying data changes. I can see applications using Windows Workflow solely for the Policy activity.

    More Workflow articles on OTC:
    Hello, Workflow - an introduction.
    Authoring Workflows - a look at XAML, XOML, and Workflow compilation.
    The Base Activity Library - a tour of the out-of-the-box activities in WF.
    Hosting Windows Workflow - a look at using the persistence, scheduling, tracking, and transaction services in WF.

  • Warning are Errors!

    I haven’t talked much about my project here on the blog, but it has been growing and growing over the last year. I am now the lead on a project including three teams and a total of sixteen developers, which can be quite tough to manage. One of the main challenges is ensuring that the code being written is high quality. We use some automated procedures like CruiseControl.NET, FxCop, and Code Coverage and whenever possible the good old fashioned code review.

    One of the things that has always bothered me though is compiler warnings, these are simple things that are usually easy to fix and just represent complete laziness when they start cropping up. I would notice these on the build reports and it always drove me crazy. Well, apparently I am the last person to know that you can tell Visual Studio to treat all warnings as errors. A quick change to all of our project files:

    and no more warnings (at least not in builds that work).

    In the future I will blog more about some of what I have found that works and doesn’t work.

    -James

  • Books: The Art of The Start by Guy Kawasaki

    Most business books consist of one idea and then around 160–200 pages of fluff talking about how that idea can be used. A business book that actually delivers some sort of value after the second or third chapter is usually a success. I picked up The Art of the Start because I have been reading Guy’s blog recently and the title is pretty irresistible. 

    I think the title is a little misleading as it really isn’t about starting “Anything”, it’s pretty focused on starting a business and more specifically a technology-oriented business. This is expected considering Guy’s company finances technology companies. The book is filled with a considerable amount of business advice, many of his lists throughout the book contain more good advice than some entire business books in their entirety. It includes a 100 small ideas instead of one big idea. 

    The book focused a little too much on getting capital, does every successful business need funding? I know of some that get by growing organically, but I don’t think these are the companies that interest a venture capitalist like Guy, or at least not as much as the ones who get funding. The saving grace of all the advice around getting funded is that the advice is often applicable to your business as a whole. I remember one point Guy made that stuck with me was about a common lie:

    Lie #6: “Proctor & Gamble is too old, big, dumb, and slow to be a threat.”

    I hear this all the time from people on why they are going to be successful, and I always thought it was a little bit naive. Sure, you might be able to carve out a niche market… but to underestimate companies who dominate the market is delusional.

    Overall I enjoyed the book and would recommend it to anyone thinking about starting their own small business or project.

    -James

     

     

  • SubText 1.9 Released!

    Congrats to Phil on getting this latest release out. I can’t wait to upgrade this weekend and check out the new features and fixes. He also launched a new skins gallery over at SubTextSkins.com.

    -James

  • Windows Workflow Foundation

    Workflow is one of the new core capabilities (along with WPF aka Avalon and WCF aka Indigo) being added in the .NET Framework 3.0 release later this year.  It provides an in-process workflow engine to process rules, a designer for VS 2005 to enable both developers and non-developers to define custom workflow processes graphically, and a new Workflow namespace to integrate these within code.  The official site to learn more about Windows Workflow Foundation can be found here.

    Over the last two weeks I've also seen a number of great new posts and web-casts published that cover it in more detail.  Below is a list of some of them you might want to explore to learn more:

     

    Windows Workflow Foundation Basics:

    .NET Rocks! Audio-Cast: Carl Franklin talks with Michael Stiefel about Windows Workflow Foundation and discusses what it is and why you might want to use.  You can listen to this show here.

    Bart De Smet has a number of great posts that cover some of the core concepts with Windows Workflow Foundation (WF):

    K. Scott Allen has also posted several good blog posts on Workflow:

    ASP.NET Page Flow:

    ASP.NET developers should checkout the ASP.NET: An Overview of ASP.NET and Windows Workflow Foundation Integration web-cast that Kashif Alam from the ASP.NET team did earlier this month.  It explores designing and developing UI workflow applications with ASP.NET and how developers will be able to use the new "Page Flow" capabilities that are being added to ASP.NET to enable developers to create representative UI for business processes defined with Windows Workflow Foundation (and avoid hardcoding in workflow logic in code).

    SharePoint 2007 Custom Workflows:

    SharePoint 2007 (which is coming out later this year and is built on ASP.NET 2.0) allows users to define and author workflows for common process activities.  Sahil has a great blog post here that describes how to use this to define a custom process for a SharePoint site.

    Hope this helps,

    Scott

    P.S. For other great ASP.NET web-casts (both upcoming as well as past ones that have been recorded and published online), please check out this Web Casts listing page on the www.asp.net site.

     

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • XNA Express Beta Available for Free Download (build XBOX games in C#)

    The XNA team released their first XNA Game Studio Express Beta release earlier today.  You can learn more about it and download it for free here (below is a screenshot from a fun app build with it).

    This release works on top of the free Visual C# Express Edition, and provides the ability to build games using C# and .NET that target both Windows and the XBOX 360 (we did the work to port a .NET execution engine with PowerPC JIT support to the XBOX to enable this). 

    The XNA Framework ships with the VS package and provides a managed code library for creating rich graphics, and incorporating 3D content into games.  I'm looking forward to having some fun with this. :-)

    You can download it for free here.

    Enjoy,

    Scott

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • SQL/.NET Job with my Client in the VA/DC Area

    My client has too much work for me to do as they've grown, so we need to bring on someone else to help us out.  First and foremost, we need someone very good with MS Sql Server and T-Sql, including procs, dts, jobs, and more.  Most of the work can be done remotely, but we also need someone that can help with network/database maintenance.  That is not the main responsibility, but it does mean we need someone reasonably close to my client's location, so we need someone that is relatively near the Virginia burbs of Washington DC, or at least willing to relocate.  It would also be great if this person was able to work with me on our .NET development, even using my ORMapper.  If this describes you, and you're interested, then please send your resume to me at VAJob-at-WilsonDotNet.com.  This is a great client to work with, but they're also very busy, so we're only looking for someone very good.
    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • Upcoming Talk for the San Diego .NET Developers Group

    Next week - Tuesday, September 5th - I'll be speaking at the San Diego .NET Developer group. My talk starts at 7:00pm and will likely run until 8:30 or so. I'll be talking about Working with Data in ASP.NET 2.0, a sort of in-person, spoken and visualized complement to the Working with Data in ASP.NET 2.0 tutorial series I've been writing for Microsoft.

    If you're in San Diego on the 5th, drop on by! The meeting is held in Sorrento Valley at one of Qualcomm's facilities, and it's probably the nicest LUG facility I've ever been to - free parking, incredibly nice plush stadium seating... it's like you're in the theaters, except the aisles aren't sticky and I'm not as dashing or exciting as Brad Pitt. But the biggest incentive is that there will be free pizza and soda!!

    Hope to see you there!

  • What's Wrong With This Code? (#4)

    This program throws an exception at runtime. If you've been burned by this problem before, you'll know what's wrong before you even see the definition for class Bar...

    using System;

    class Program
    {
      
    static void Main()
      {
        
    Foo foo = new Bar();
      }
    }

    abstract class Foo
    {
      
    public Foo()
      {
        Init();
      }

      
    protected abstract void Init();
    }

    class Bar : Foo
    {
      
    string message;

      
    public Bar()
      {
        message =
    "Hello!";
      }

      
    protected override void Init()
      {
        
    Console.WriteLine(message.ToUpper());
      }
    }

  • Weird Thread Behavior

    I stumbled on a forum posting recently that led me to write the following code:

    using System;
    using System.Threading;

    class Program
    {
      
    static void Main()
      {
        
    ThreadStart doNothing = delegate { };

        
    ThreadStart createThreads =
          
    delegate
          {
            
    for (int i = 0; i < 50; i++)
            {
              
    Thread t = new Thread(doNothing);
              t.Priority =
    ThreadPriority.BelowNormal;
              t.Start();
            }
          };

        
    for (int i = 0; i < 2; i++)
        {
          
    Thread t = new Thread(createThreads);
          t.Start();
        }

        
    Console.ReadLine();
      }
    }

    This program behaves badly on a single processor machine, and pegs the CPU at 100% for over two minutes. On a multi processor machine, the program finishes all the threading work in the blink of an eye - only a brief CPU spike.

    Strangely, if I remove a single line of code:

    t.Priority = ThreadPriority.BelowNormal;

    … then the program performs just as well on a single processor machine (only a brief spike - comparable to the MP scenario).

    Could it be a bug?

  • Slides + Samples Posted from my TechEd LINQ Talk

    One of the highlights for me of my recent trip to TechEd NZ and Australia was the opportunity I had to create and present a new "Building Data Driven ASP.NET Web Applications using LINQ" talk.  LINQ is a super cool new technology, and is going to have an absolutely enormous impact on .NET developers and how they use data.  I had a lot of fun doing the talk, and people seemed to really like it (someone told me just before I flew back that it was the most highly rated talk at TechEd this year).

    You can download the final slides + samples I presented here

    The samples use a class library that I built during that talk that encapsulates my LINQ data model classes that go against the Northwind database (please read this post to learn more about how to build a re-usable LINQ class library like this).  I also then included 14 separate ASP.NET page samples that show off different concepts within LINQ (starting with LINQ for Objects, then LINQ for SQL, and then LINQ for XML).  Update the northwind connectionstring within the web.config file of the web-site to run them against any SQL Northwind sample database instance you have.

     

    Learning more about LINQ

    To learn more LINQ with ASP.NET, please read these other posts I've done about it:

    Hope this helps,

    Scott

     

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • Building and using a LINQ for SQL Class Library with ASP.NET 2.0

    In my previous posts on doing data access using LINQ and ASP.NET, I used the built-in SQLMetal command-line utility to automatically generate the data model classes for my LINQ data classes.  Recently I've been using the LINQ for SQL (aka DLINQ) designer to define my data models instead, and have been really impressed with how easily it enables me to build a re-usable class library that nicely encapsulates my data and business logic.

    The below walkthrough demonstrates how you can get started with it yourself.  Simply install the LINQ May CTP download on top of VS 2005, and you can then follow along all of the steps below yourself.  For the sample below I am using C#, but everything works equally well in VB as well.

     

    Step 1: Create a New LINQ Enabled Class Library

    Choose File->New Project within Visual Studio and navigate to the "LINQ Preview" node in the project-type tree-explorer.  Then select the "LINQ Library" project icon and create a new LINQ enabled class library:

    This will create a class library project whose MSBuild project file enables compilation support for LINQ.  A default "Class1.cs" file is added to the project -- I recommend just deleting it to start with an empty project.

     

    Step 2: Add a LINQ for SQL Data Model to the Project

    Right-click on the project and choose the Add->New Item context menu item.  Scroll down in the dialog and select the "DLINQ Object" icon, and give it an appropriate name (in this sample I'm naming it "Northwind" since I'm going to be modeling the Northwind database):

    This will add a Northwind.dlinq file to your project, and bring up its designer:

    You can now use the designer to map your data models and entities graphically, as well as setup associations to map relationships between them.

     

    Step 3: Quickly creating a Northwind data model

    One of the really easy ways to quickly define your data model classes is to open up the Server Explorer tab within VS 2005 and connect to your database.  You can then drill into the Tables and Views within your database, and drag/drop them from the server explorer onto the DLINQ designer surface to automatically create data models for them.  For example, if I dragged/dropped the Suppliers, Customers, Orders, Order Details, and Products tables onto the designer surface, I'd by default get a data model that looks like this:

    Note how the DLINQ designer automatically sets up default associations between the different entities based on the Primary Key/Foreign Key relationships in the database.  These will automatically cause properties to be created on the various data classes so that we can perform rich querying and/or easily traverse between them.  For example, if I had a "Customer" instance above I could simply access the "Customer.Orders" property to get a collection of all of that Customer's orders in the database.

    If you want, you can add, delete or alter these associations by simply clicking on the association links in the designer and then use the property grid to change its settings.  For example, if I wanted to modify the "Order Details" associations above to instead be named "OrderDetails", I would click on the association line in the designer and change it either via the property grid:

    Or because it supports inline editing for the name, just click on the name in the designer and rename it in place:

    Additionally, I could use the designer to easily rename the entities and/or rename/remove/add properties to them.  Once we are done defining your data models, we'll just save the file.  The designer will then automatically generate a .cs or .vb file containing the LINQ data class definitions.  This is saved in a nested file underneath the Northwind.dlinq item in the solution explorer:

    The LINQ data model classes created are defined as "partial" classes -- which means we will be able to go in later and add entity and property validation rules that enforce our business logic, as well as add any additional properties or helper methods we want to the classes.

     

    Step 4: Creating a LINQ Enabled Web-Site that References our LINQ enabled Class Library

    We'll now want to go ahead and build a LINQ-enabled ASP.NET web-site that uses our LINQ class library.  Choose File->Add->Web Site within Visual Studio to add a new project to the solution.  Choose the LINQ web-site template to create an ASP.NET web-site that is enabled with the LINQ compilers:

    Your VS solution will then look like this:

    The last two steps you'll want to take are to:

    1) Add a project reference from the web-site project to the LINQ class library.  To-do this, right-click on the web-site and select "Add Reference", select the "Projects" tab and add the reference as normal.

    2) Add a connection-string to your web.config file in the web-site project for the LINQ class library.  This will enable you to easily configure and change the connection-string that is used at runtime for the application.  Simply copy/paste the connection-string value in the LINQ class library's app.config file to the web.config file's <connectionString> section to configure this.

    Once the above two steps are done, we are ready to build ASP.NET UI pages against our LINQ class library and associated data models.

     

    Step 5: Build a simple Products Listing Page

    To give a simple taste of using LINQ, we'll build a simple Product Listing page that lists products like the image below:

    To implement this, I'll add a templated ASP.NET DataList control to the .aspx page using the markup below to define the UI for each product in our list:

    <asp:DataList ID="DataList1" RepeatColumns="2" runat="server">

        
    <ItemTemplate>
        
           
    <div class="productimage">
                
    <img src="images/productimage.gif" />
            </
    div>
        
            
    <div class="productdetails">
            
                
    <div class="ProductListHead">
                    
    <%#Eval("ProductName")%>
                
    </div>
                
                
    <span class="ProductListItem">
                    
    <strong>Price:</strong>
                    
    <%# Eval("UnitPrice", "{0:c}") %>
                
    </span>
                
            
    </div>                
        
        
    </ItemTemplate>

    </asp:DataList>

    I can then use the below code-behind class to execute a LINQ query against the class library data model we defined in our class library previously to retrieve all of the products in the database supplier by the "Exotic Liquids" supplier and sorted by the product name:

    using System;
    using 
    System.Web;
    using 
    System.Query;
    using 
    LINQClassLibrary;

    public 
    partial class HelloWorld : System.Web.UI.Page {

        
    protected void Page_Load() {

            NorthwindDataContext db 
    = new NorthwindDataContext();

            
    DataList1.DataSource from p in db.Products
                                   where p.Supplier.CompanyName == "Exotic Liquids"
     
                                   
    orderby p.ProductName
                                   select p
    ;

            
    DataList1.DataBind();
        
    }
    }

    Notice above how the LINQ query is strongly-typed, and can incorporate the Product/Supplier entity association we setup earlier (for example: note how the where statement is able to search by the product's Supplier.CompanyName property -- which is stored in the Suppliers table and is linked to the Products table via a primary key/foreign key relationship). 

    This strong typing model means I get compile-time checking of my LINQ queries today, and will get full intellisense support with the new release of Visual Studio.  No more runtime SQL syntax errors!

    And that is it.  No additional code required. 

     

    Step 6: Using Debug Visualizers to inspect what SQL is executed against the database

    One of the most common questions people wonder when using ORM data frameworks is "so what SQL code is it running under the covers?".  LINQ makes it easy to figure this out.  Just set a debugging breakpoint on a LINQ expression variable, and you can use a built-in LINQ debugging visualizer to inspect it while debugging. 

    For example, set a breakpoint on the DataList1.DataBind() method above and when it is hit hover your mouse over the DataList1.DataSource property and click the magnifying glass to launch its DLINQ query visualizer:

    This will bring up a visualizer dialog that displays the SQL statement that LINQ will execute against the database when evaluating that LINQ expression:

    If you click the "execute" button on the bottom-right you can even test out the query in the debugger and see the exact data that will be returned from it when the supplier name is "Exotic Liquids" is this:

    This makes it really easy to see the exact SQL that is executed and closely watch what is going on as you modify and refine your LINQ queries.

     

    Summary

    Hopefully the above walkthrough provides a good introduction to some of the cool things you can do with LINQ and the LINQ May CTP version of it. 

    To learn more about LINQ with ASP.NET, please checkout the post I am going to be doing in a few minutes which links to a bunch of good resources and which includes the sample I used above.

    Hope this helps,

    Scott

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • Building and Using a &quot;LINQ for SQL&quot; Class Library with ASP.NET 2.0

    In my previous posts on doing data access using LINQ and ASP.NET, I used the built-in SQLMetal command-line utility to automatically generate the data model classes for my LINQ data classes.  Recently I've been using the LINQ for SQL (aka DLINQ) designer to define my data models instead, and have been really impressed with how easily it enables me to build a re-usable class library that nicely encapsulates my data and business logic.

    The below walkthrough demonstrates how you can get started with it yourself.  Simply install the LINQ May CTP download on top of VS 2005, and you can then follow along all of the steps below yourself.  For the sample below I am using C#, but everything works equally well in VB as well.

     

    Step 1: Create a New LINQ Enabled Class Library

    Choose File->New Project within Visual Studio and navigate to the "LINQ Preview" node in the project-type tree-explorer.  Then select the "LINQ Library" project icon and create a new LINQ enabled class library:

    This will create a class library project whose MSBuild project file enables compilation support for LINQ.  A default "Class1.cs" file is added to the project -- I recommend just deleting it to start with an empty project.

     

    Step 2: Add a LINQ for SQL Data Model to the Project

    Right-click on the project and choose the Add->New Item context menu item.  Scroll down in the dialog and select the "DLINQ Object" icon, and give it an appropriate name (in this sample I'm naming it "Northwind" since I'm going to be modeling the Northwind database):

    This will add a Northwind.dlinq file to your project, and bring up its designer:

    You can now use the designer to map your data models and entities graphically, as well as setup associations to map relationships between them.

     

    Step 3: Quickly creating a Northwind data model

    One of the really easy ways to quickly define your data model classes is to open up the Server Explorer tab within VS 2005 and connect to your database.  You can then drill into the Tables and Views within your database, and drag/drop them from the server explorer onto the DLINQ designer surface to automatically create data models for them.  For example, if I dragged/dropped the Suppliers, Customers, Orders, Order Details, and Products tables onto the designer surface, I'd by default get a data model that looks like this:

    Note how the DLINQ designer automatically sets up default associations between the different entities based on the Primary Key/Foreign Key relationships in the database.  These will automatically cause properties to be created on the various data classes so that we can perform rich querying and/or easily traverse between them.  For example, if I had a "Customer" instance above I could simply access the "Customer.Orders" property to get a collection of all of that Customer's orders in the database.

    If you want, you can add, delete or alter these associations by simply clicking on the association links in the designer and then use the property grid to change its settings.  For example, if I wanted to modify the "Order Details" associations above to instead be named "OrderDetails", I would click on the association line in the designer and change it either via the property grid:

    Or because it supports inline editing for the name, just click on the name in the designer and rename it in place:

    Additionally, I could use the designer to easily rename the entities and/or rename/remove/add properties to them.  Once we are done defining your data models, we'll just save the file.  The designer will then automatically generate a .cs or .vb file containing the LINQ data class definitions.  This is saved in a nested file underneath the Northwind.dlinq item in the solution explorer:

    The LINQ data model classes created are defined as "partial" classes -- which means we will be able to go in later and add entity and property validation rules that enforce our business logic, as well as add any additional properties or helper methods we want to the classes.

     

    Step 4: Creating a LINQ Enabled Web-Site that References our LINQ enabled Class Library

    We'll now want to go ahead and build a LINQ-enabled ASP.NET web-site that uses our LINQ class library.  Choose File->Add->Web Site within Visual Studio to add a new project to the solution.  Choose the LINQ web-site template to create an ASP.NET web-site that is enabled with the LINQ compilers:

    Your VS solution will then look like this:

    The last two steps you'll want to take are to:

    1) Add a project reference from the web-site project to the LINQ class library.  To-do this, right-click on the web-site and select "Add Reference", select the "Projects" tab and add the reference as normal.

    2) Add a connection-string to your web.config file in the web-site project for the LINQ class library.  This will enable you to easily configure and change the connection-string that is used at runtime for the application.  Simply copy/paste the connection-string value in the LINQ class library's app.config file to the web.config file's <connectionString> section to configure this.

    Once the above two steps are done, we are ready to build ASP.NET UI pages against our LINQ class library and associated data models.

     

    Step 5: Build a simple Products Listing Page

    To give a simple taste of using LINQ, we'll build a simple Product Listing page that lists products like the image below:

    To implement this, I'll add a templated ASP.NET DataList control to the .aspx page using the markup below to define the UI for each product in our list:

    <asp:DataList ID="DataList1" RepeatColumns="2" runat="server">

        
    <ItemTemplate>
        
           
    <div class="productimage">
                
    <img src="images/productimage.gif" />
            </
    div>
        
            
    <div class="productdetails">
            
                
    <div class="ProductListHead">
                    
    <%#Eval("ProductName")%>
                
    </div>
                
                
    <span class="ProductListItem">
                    
    <strong>Price:</strong>
                    
    <%# Eval("UnitPrice", "{0:c}") %>
                
    </span>
                
            
    </div>                
        
        
    </ItemTemplate>

    </asp:DataList>

    I can then use the below code-behind class to execute a LINQ query against the class library data model we defined in our class library previously to retrieve all of the products in the database supplier by the "Exotic Liquids" supplier and sorted by the product name:

    using System;
    using 
    System.Web;
    using 
    System.Query;
    using 
    LINQClassLibrary;

    public 
    partial class HelloWorld : System.Web.UI.Page {

        
    protected void Page_Load() {

            NorthwindDataContext db 
    = new NorthwindDataContext();

            
    DataList1.DataSource from p in db.Products
                                   where p.Supplier.CompanyName == "Exotic Liquids"
     
                                   
    orderby p.ProductName
                                   select p
    ;

            
    DataList1.DataBind();
        
    }
    }

    Notice above how the LINQ query is strongly-typed, and can incorporate the Product/Supplier entity association we setup earlier (for example: note how the where statement is able to search by the product's Supplier.CompanyName property -- which is stored in the Suppliers table and is linked to the Products table via a primary key/foreign key relationship). 

    This strong typing model means I get compile-time checking of my LINQ queries today, and will get full intellisense support with the new release of Visual Studio.  No more runtime SQL syntax errors!

    And that is it.  No additional code required. 

     

    Step 6: Using Debug Visualizers to inspect what SQL is executed against the database

    One of the most common questions people wonder when using ORM data frameworks is "so what SQL code is it running under the covers?".  LINQ makes it easy to figure this out.  Just set a debugging breakpoint on a LINQ expression variable, and you can use a built-in LINQ debugging visualizer to inspect it while debugging. 

    For example, set a breakpoint on the DataList1.DataBind() method above and when it is hit hover your mouse over the DataList1.DataSource property and click the magnifying glass to launch its DLINQ query visualizer:

    This will bring up a visualizer dialog that displays the SQL statement that LINQ will execute against the database when evaluating that LINQ expression:

    If you click the "execute" button on the bottom-right you can even test out the query in the debugger and see the exact data that will be returned from it when the supplier name is "Exotic Liquids" is this:

    This makes it really easy to see the exact SQL that is executed and closely watch what is going on as you modify and refine your LINQ queries.

     

    Summary

    Hopefully the above walkthrough provides a good introduction to some of the cool things you can do with LINQ and the LINQ May CTP version of it. 

    To learn more about LINQ with ASP.NET, please checkout the post I am going to be doing in a few minutes which links to a bunch of good resources and which includes the sample I used above.

    Hope this helps,

    Scott

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • Great New Atlas Videos Published (All Free)

    Joe Stagner has been busy at work publishing more Atlas videos on the www.asp.net website (click here for the full video listing). 

    Here are a few pointers to some of the recent Atlas videos he has posted:

    - Add "Atlas" features to an existing ASP.NET web application: Learn how to easily add Atlas functionality to an existing ASP.NET application, and demonstrates how to add the Atlas assembly and configure it within a site (4 minutes, 33 seconds).

    - Implement Dynamic Partial-Page Updates using Atlas: Learn how to to use the Timer control in Atlas to dynamically refresh portions of an ASP.NET page (5 minutes, 31 seconds).

    - Using the Atlas Control Toolkit Cascading Dropdownlist Extender: Learn how to implement cascading drop-downlist UI with Atlas server controls, which enables you to have drop-down lists depend on values in another drop-down list on the client without requiring any postbacks to occur (19 minutes, 9 seconds).

    - Make Client-Side Network Callbacks with Atlas: Learn how Atlas makes it easy to make network callbacks from the client to the server and provides a rich JSON networking stack (11 minutes, 33 seconds).

    - Atlas Enable Existing Web Services: Learn how to add JSON networking support to your existing web services, and easily create JavaScript client proxies that can invoke and call them (6 minutes, 20 seconds)

    - Using the Atlas Control Toolkit Popup Control Extender: Learn how to use the Popup Control Extender to enable Ajax popup UI (10 minutes, 19 seconds)

    - Using the Atlas Control Toolkit TextBoxWatermark Control Extender: Learn how to easily add watermark support to input controls on your site (4 minutes, 52 seconds long).

     

    In addition to the above new videos, you can also check out these two to help get you started:

    - Getting Started with "Atlas": This video demonstrates how to install Atlas for the first time and build your first site with it (10 minutes, 2 seconds).

    - Getting Started with the Atlas Control Toolkit: This video demonstrates how to install and use the Atlas Control Toolkit suite of additional Atlas controls in your site (12 minutes, 9 seconds).

     

    Also -- to learn more about the most recent Atlas CTP and Atlas Control Toolkit release, please check out this post of mine from two weeks ago that covers more.

    Hope this helps,

    Scott

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • Upcoming Talk at the SoCal .NET Technical Summit

    On Saturday, September 23rd, I'll be speaking at the SoCal .NET Technical Summit in Irvine, CA at the Hilton next to the John Wayne Airport. I'll be doing a “Top 10 ASP.NET 2.0 Tips & Traps” talk, which makes me the biggest Scott Guthrie/Rob Howard fanboy (Scott recently presented an ASP.NET Tips and Tricks talk at TechEd in New Zealand, and Rob Howard's done a “Top 10 Tips for Writing High Performance Websites” talk before).

    Anywho, the reason I'm posting this is two-fold. First, I want you to come to the Summit! Yes, I'm talking to you. Come on, go, it will be a day full of fun and educational value, with talks broken down into Architecture, Web, Data, and .NET 3.0 tracks. It's only $79 for the conference. Go ahead and register now.

    Second, I'd like to get some feedback/suggestions on my talk. Here are my proposed Top 10 Tips & Traps:

    • TIP: Use HttpContext.Items as a per-request cache (stole this shamelessly from Rob Howard's performance talk, but it's my favorite of his)
    • TRAP: Not setting applicationName setting when using Membership (a trap many people getting started with Membership fall into)
    • TIP: A walkthrough of cool Visual Studio 2005 features (I'm thinking about some of the XHTML validation stuff, code snippets, opening an ASP.NET 2.0 website through the command line/Explorer, etc.)
    • TIP: Client-side enhancements (the new OnClientClick property, the Focus() method, etc.)
    • TIP: Efficiently paging through large resultsets with SQL Server 2005's new ROW_NUMBER() feature
    • TIP: Using Reflector (not really ASP.NET-specific, but a tool/knowledgeset every .NET developer should have)
    • TRAP: How to handle broken images/links in images, CSS files, etc. A common problem when using a Master Page in one folder and having ASP.NET pages in different folders. In short, use ~
    • TIP: Disabling view state for data Web controls to reduce page bloat
    • TIP: Use caching. An overview of data caching, output caching, and SQL-dependent caching
    • TRAP: Avoid race conditions when caching - see http://scottonwriting.net/sowblog/posts/1982.aspx

    I'm a little wishy-washy on some of these, this list was what I came up with a couple days ago. Care to help me shore up this list? Any suggestions for tips/traps? Any tips/traps you'd prefer removed, or relegated to “Only cover if you have adequate time?”

    Any suggestions, comments, ideas, and constructive criticism is most welcome. You can either post it as a comment here, or drop me a line at mitchell@4guysfromrolla.com

    Hope to see you at the SoCal .NET Technical Summit!

  • My $100 Spending Spree with Windows Workflow

    The WF discussion that Brian Noyes kicked off continues with excellent points from Jon Flanders and Thomas Restrepo. The following posts are full of information from smart people who know WF very well:

    You have to understand a technology to use it effectively…
    Workflow Complexity
    Workflow Complexity Part 2

    Tech evangelist Matt Winkle then asked how to improve WF. In other words - quit bitching and offer us constructive ideas.

    If I had a $100 budget to improve WF, I'd divide the money as follows:

    $30 on designer improvements. The designer has a number of minor irritations, but one stands out at this very moment. Building declarative rules requires me to navigate a number of modal dialogs, and those dialogs prevent me from getting anywhere else in Visual Studio. When I double-click a .rules file, or ask for a new rule in the properties windows, I want a spiffy designer to appear in the editor. Each time a modal dialog appears in Visual Studio, another star falls from the heavens.

    $30 on guidance. Simon Ince threw out the idea of a workflow factory / guidance toolkit. I'd also like to see more content covering common workflow patterns and best practices for hosting, versioning, and scaling.

    $30 on "activity packs". Incrementally augment the base activity library with "activity packs". Microsoft could make activity packs available for download as they are developed and in-between major releases of WF. Each activity pack could cover a specific technology domain. Examples: a database activity pack, a WCF activity pack, a file system activity pack, and an XML activity pack. We could download just the activity packs we need.

    $10 on an open source base activity library.WF will really shine in scenarios where domain specific activities are available (look at casey's article with a Speech Server workflow to see the flexibility and power of WF). First, however, a team has to build good looking and well-behaved domain specific activities. As Thomas says in his post - "Creating new activities is easy. Creating good activities can be pretty hard." The WF site already includes a number of custom activities, but activities are the lifeblood of WF, and we can always use more.

    Earlier this year, the ASP.NET team released source code for all the built-in ASP.NET 2.0 providers, so this idea isn't unthinkable. Providing source and documentation for the BAL would be a tremendous boon for custom activity development.

  • ASP.NET 2.0 Tips/Tricks TechEd Talk Posted

    Many thanks to everyone in New Zealand who attended my "ASP.NET 2.0: Tips and Tricks" talk this morning. 

    You can download the slides + samples from my talk here.  The samples are number in numbered order and correspond to the slides:

    Enjoy!

    Scott

    P.S. I will also be posting the slides+samples from my LINQ talk a little later today (I first need to jump on a plane to Australia and am running out of time <g>).  So stay tuned for those as well.

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • Details on CSS Changes for IE7

    The Internet Explorer team maintains a really good blog here: http://msdn.blogs.com/ie that I recommend subscribing to for useful information.

    They recently posted a good blog post detailing some of the CSS changes that have been made with IE 7.0 to enable it to handle CSS better.  This is worth bookmarking if/when you are testing your site with IE7 going forward. 

    Hope this helps,

    Scott

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • IIS7, ASP.NET 2.0, Atlas and VS 2005 End to End Talk

    Many thanks to everyone in New Zealand who attended my "ASP.NET: End-to-End - Building a Complete Web Application Using ASP.NET 2.0, Visual Studio 2005, and IIS7 (Parts 1 and 2)" talk this afternoon.

    You can download the slides from my talk here.  You can then download the application I built here (note: this .zip file is actually the version I published after the US TechEd, but is the same code I wrote on stage today). 

    There is a "ReadMe.txt" file in the root of the demos .zip file that walksthrough how to setup the demos.  I've included two versions of the app -- one is in the "IIS7" directory and allows you to run the application using IIS7 on Windows Vista Beta2.  The other is a slightly modified version of the sample that also works on IIS5, IIS6, and the built-in VS 2005 Web Server.  The difference is that the non-IIS7 version doesn't use URL-rewriting for the pretty-URL feature.

    Hope this helps,

    Scott

    Share this post: Email it! | bookmark it! | digg it! | reddit!
  • Live WriteFox

    When Windows Live Writer first came out I had the idea that I should do an extension for Firefox that would allow you to easily blog the page you are on. Similar to the one I built for BlogJet. The problem is that instead of command line switches like BlogJet you have to use a COM interface. I couldn’t find an easy way to call the interface directly from Firefox without writing some XPCOM, which I was about to try. But thankfully Can Erten beat me to it and came up with a different solution. The Live WriterFox extension does exactly what I need it to, and instead of using XPCOM he simply wrote a command-line exe that is packaged with the extension to call the COM interface. Brilliant!

    I am still trying out Windows Live Writer as well as the Performancing extension for Firefox as alternatives to BlogJet. Performancing seems to offer some cool added features like blog stats and notes, but I think I will stick with BlogJet for now.

    -James