Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
West Wind WebSurge - Rest Client and Http Load Testing for Windows

ASP.NET Connections Slides and Samples Posted


:P
On this page:

I've posted my session slides and samples from my ASP.NET Connections sessions last week in Orlando. I did three sessions at the conference and you can check out the slides and samples here. All three sessions had extensive samples (and I didn't even get to them all) so if you attended my sessions be sure to take a look at the samples as there's lots of extra stuff that didn't get covered in sessions.

The files posted here are more current than the original code and slides provided at the conference and the immediate updates I posted. I spent a little more time cleaning up a few dependencies, hopefully making it a little easier to get the samples running. Please be sure to read the _readme.htm files (or the Configuration links on the default page) in each of the projects, as they include important information about set up to run the samples and setting up the databases.

Here are the links and summaries of each of the sessions:

Ajax Alternatives: Using jQuery with ASP.NET

This was by far the most fun session for me, partly because I've been working with jQuery so much in recent months, but also because it was a really interactive session. I started this session with a basic ASP.NET page and went through the motions of adding jQuery functionality to the page. In 10 minutes of hands on building up of the page I went through a wide cross section of jQuery from selector syntax to document manipulation, to special effects, using plug-ins and  creating an plugin. From there the session has samples that demonstrate basic Page based AJAX operation - Ajax without any sort of framework on the backend, followed by examples and some generic helper code that lets you use WCF 3.5's Ajax support with jQuery. Samples include demonstrations of HTML loading, using server based HTML templating (ie. poor man's UpdatePanel like behavior) and raw data results with JSON. The WCF examples provide mroe data driven examples which demonstrates the same examples, but using purely client side manipulation of the DOM with data from the server. The two examples use a stock quote server and portfolio display that is rendered and updated client side including a nice interactive display. I also showed a cool photo album application that shows off a few useful plug ins including sortables and an inplace editing component I created for doing real time and in place  data updates using the DOM as the data storage mechanism. Finally there is an example of a jQuery component (jquery.ui's DatePicker control) wrapped as an ASP.NET control for easier usage in the ASP.NET environment.

The photo album application is running on my site here:

http://www.west-wind.com/rick/photoalbum/

and a demo that allows access to the admin functions the demonstrate the more interesting features can be accessed at this particular URL:

http://www.west-wind.com/rick/photoalbum/demoMaui2006/Default.aspx

(this demo likely will get trashed by vandals since it allows user input and I'll probably pull it after a few days or so, so check it out now while it's there)

You can download this session from:

http://www.west-wind.com/files/conferences/jquery.zip

 

WCF 3.5 JSON and REST Services

This session's focus is on the new WCF 3.5 HTTP features that provide support for REST principles and AJAX support. WCF 3.5's AJAX support has been made nearly as easy and comprehensive as ASMX functionality and there are many options of how data can be accessed over HTTP now with official protocol support for the webHttpBinding. This session starts of with examples of pure REST URLS and demonstrates features like URL templating, different response formats (wrapped, bare, XML, Json) as well as the various different options for serving in this fashion. THere are also examples of serving up raw data such as images or HTML content out of the REST based API. The remainder of the session focuses on AJAX functionality and explores different ways that WCF services can be called. There's a comprehensive Stock Service example that shows simple stock quote retrieval, a more complex portfolio manager and streaming stock history graphs to the browsers. Examples are provided for using Microsoft ASP.NET Ajax as a client as well as jQuery as a client in order to avoid loading of Microsoft Client Libraries.

You can download this session from:

http://www.west-wind.com/files/conferences/wcfRest.zip

 

Building a LINQ to SQL Business Layer for ASP.NET Applications

Focus of this session is on a LINQ to SQL Business object framework that wraps LINQ to SQLs data access model. LINQ to SQL - although completely object based, is still little more than a sophisticated data access layer and so a business object layer is still needed to abstract business logic and provide common functionality that every business related entity requires. THe business layer provides a few high level abstractions to the CRUD layer as well as a host of low level features that allow better control for low level data access in case LINQ to SQL queries are ill suited for queries and operations that cannot be performed with LINQ to SQL at all. This session includes a simple but comprehensive Time and Billing example application that demonstrates many aspects of working with LINQ to SQL using this business layer.

This is an update to previous versions of the LINQ to SQL Business layer I've put out. Enhancements in this version include removal of the requirement for tables to have timestamp fields, several enhancements to dynamic expression usage internally and a few small bug fixes.

You can download this session from:

http://www.west-wind.com/files/conferences/LinqtoSqlBusiness.zip

 

Hope you find some of this stuff useful.

Posted in Conferences  

The Voices of Reason


 

yaip
May 01, 2008

# re: ASP.NET Connections Slides and Samples Posted

Is the photo album in jQuery? I've used a Silverlight version here:

http://www.justthinkart.com/sl/Illustration/Acrylics.aspx

Guy Harwood
May 02, 2008

# re: ASP.NET Connections Slides and Samples Posted

Cheers Rick.

Interested to see the updated LinqToSql Business Layer.

Dennis Bailey
May 05, 2008

# re: ASP.NET Connections Slides and Samples Posted

Rick,

Your work is dearly appreciated! You have saved me countless hours of digging for this kind of information and made me more productive!

Thanks for all of your hard work!

Speednet
May 05, 2008

# re: ASP.NET Connections Slides and Samples Posted

Rick,

Nice job boiling down the LINQ to SQL stuff. Not only a terrific summary, but clearly sprinkled with lots of hard-earned wisdom. I very much look forward to your deep-dives on the ADO Entity Framework when it ships. I hope lots of people get a chance to benefit from the tremendous assets you're put together here.

Ian Hughes
May 05, 2008

# re: ASP.NET Connections Slides and Samples Posted

When considering an ORM for new projects there are numerous options these days, but L2Sql and L2Ent has seen its fair share of criticism right out of the box. Many bloggers seem to just say "it doesn't work right yet" and move on, but Rick, you have posted a lot of really great stuff and certainly inspired me to give it a shot outside of sandboxing some proof of concepts.

Martillo
May 14, 2008

# re: ASP.NET Connections Slides and Samples Posted

Rick,

Thank you for the extensive example of how to wrap a business framework around LINQ to SQL.

I'm not sure I've deciphered your rationale for including the empty partial entity classes in the TimeTrakkerEntites.cs file, but I've discovered one nice side effect of it: If I add a summary comment to one of the partial classes, then VS.Net Intellisense will display the summary information throughout the solution wherever I reference that class, and my comment will survive designer re-generation cycles.

The inability to add comments to the designer-generated entity classes had been bugging me. I think it would be helpful if "Comments" were one of the properties you could set in the designer. But for now this looks like a good workaround.

Rick Strahl
May 14, 2008

# re: ASP.NET Connections Slides and Samples Posted

@Martillo - I tend to ALWAYS create a shadow class for the generated entities so I have a place to put any class extensions. I actually had some extensions in place at some point, but I removed them as it turned out I didn't need them.

Yeah I too wish that the designer would automatically pick up database descriptions if they exist on the fields of the database. That's what I use in my own generators typically. One of these days I might still re-write mine to generate enties in the same attribute markup L2S uses <g>...

Dag
May 16, 2008

# re: ASP.NET Connections Slides and Samples Posted

In your wwBusinessObject class there is a small bug in the initialize method when you use a custom connection string for the datacontext.

Correct code below:

protected virtual void Initialize()
        {
            // *** Create a default context
            if (this.Context == null)
            {
                if (!string.IsNullOrEmpty(this.Options.ConnectionString))
                {
                    //bugfix, 16.05.2008
                    //this.CreateContext(this.Options.ConnectionString);
                    this.Context =  this.CreateContext(this.Options.ConnectionString);
               }
                else
                    this.Context = this.CreateContext();
            }

            // *** Initialize Table Info 
            this.TableInfo = new TableInfo(Context, typeof(TEntity));            
        }

Lee
May 18, 2008

# re: ASP.NET Connections Slides and Samples Posted

Awesome... Thanks again for taking the time to post this stuff up Rick!!

Ranji
May 22, 2008

# re: ASP.NET Connections Slides and Samples Posted

Hi Rick,
I have an unrelated question regarding DataContext. Like you suggested, my team wraps the datacontexts in appropriate business objects but how do you deal with linq to sql classes within your datacontexts when they have to participate in more than one datacontext.
for instance, my user table participates in the SecurityDataContext as well as PurchaseOrderDataContext. So now, I am forced to have 2 different classes for a given database table(user)/ or linq to sql class(user). And then ofcourse, my User business object class.
Where am I going wrong?
Sorry for posting this comment on another one of your posts.

Dag
June 03, 2008

# re: ASP.NET Connections Slides and Samples Posted

In the Save(TEntity entity) method a new context is sometimes created to insert (or attach) disconnected entity object.

Below is a bugfix in the CreateContext method so we always use the custom ConnectionString if the Options is set.

/// <summary>
        /// Creates an instance of the context object.
        /// </summary>
        /// <returns></returns>
        protected virtual TContext CreateContext()
        {
            //03.06.2008 - Bugfix. Always take into account the custom connection string in Options
            // if it has been set
            if (this.Options == null)
            {
                return new TContext() as TContext;
            }
            else
            {
                return Activator.CreateInstance(typeof(TContext), Options.ConnectionString) as TContext;
            }
            
        }

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024