About Links Archives Search Feed Albums of Note


Notes From Guathon Birmingham

On March 26, Scott Guthrie came and talked to about 200 developers in the centre of Birmingham. For six hours. Here’s the abridged and annotated version of what he said about ASP.NET

Talk 1 : ASP.NET Development The focus for ASP.NET 4.0 is to improve the end-to-end development scenarios, and to provide a productivity boost for all development within VS2010.

Improvements in VS2010 * Intellisense in VS2010 now takes three hints for filtering items: the start of the class or member name, a substring of the name, and its ‘initials’ based on how it’s spelled using pascal/camel casing. For example, type HttpCac, Cache or HCP and you’ll get HttpCachePolicy in the intellisense list. * When you select a variable all instance of that variable are highlighted in the code editor window. * You can make box  vertical selections in the code editor window by holding down the alt key * Snippet support has been added for most asp.net and http elements. Perhaps the most used of these will be “runat tab tab” to add =“server”. However, there is no snippet support yet in the XAML editors. * When editing javascript, variable type inference informs what intellisense lists for that object. This feature works across multiple javascript files by adding comment at the top of the file referencing the other page

///

When using Intellitrace, does edit and continue work after you step backwards? The answer depends on the IntelliTrace collection level. If the user has set the collection level to “IntelliTrace events and call information”, then edit and continue is disabled altogether. If the collection level is set to “IntelliTrace events only”, edit & continue is supported.

Does intellitrace require us to use .NET 4.0 or will it work with earlier versions of .net? IntelliTrace works on CLR 2.0 and above.

Can you create a sequence diagram in VS, save it and then use that diagram as a basis for code generation in another project? We do not have code generation out of the box from sequence diagrams.  It certainly would be possible to write an extension that would do that though.

Multi-Targetting * .net4 includes a new CLR and version string. * VS2010 supports multi-targeting for .NET 2.0, 3.0, 3.5, and 4.0. * A new AppPool type is added to IIS for .net 4.0 websites when .net 4.0 is installed. * VS2010 will install side by side with VS2008. However VS2008 does not read VS2010 project files. Meanwhile VS2010 will auto-convert VS2008 project files to VS2010 so you’ll need to maintain separate solution and project files for teams working with both versions of visual studio * When you set the target framework in a project properties screen in VS2010, you can select all four .net frameworks plus “Load Other Frameworks”. Intellisense in VS2010 is informed by the shipped reference assemblies for the targeted framework rather than the version of .net that visual studio is built against. So when a new set of reference assemblies is released, you can ‘Load Other Assemblies’ to include those reference assemblies in your list of frameworks to target. (For example, reference assemblies already exist for Windows Phone & Silverlight. Theoretically you could also create reference assemblies for Mono.)

VS2010 installs safely side-by-side with vs2008 on the machine, but does vs2008 install safely side-by-side with vs2010 already on the machine?

Yes – this works fine.

Will the reference assemblies for Silverlight 4 be included with its installer or will they be a separate download? Ditto for RTM Win Phone 7.

Yes – they are included as part of the SL4 tools and Windows Phone 7 tools.  No separate download required.

Webforms 4.0 * New project templates [http://blog.hmobius.com/post/2010/02/15/ASPNET-40-Part-2-New-Projects-New-Items.aspx] (empty and running sites) * Cleaner web.config file [http://blog.hmobius.com/post/2010/02/16/ASPNET-40-Part-3-Someone-has-stolen-webconfig!.aspx] . Compilation debug=true set as standard * Cleaner HTML for menus [http://blog.hmobius.com/post/2010/03/03/ASPNET-Part-9-Rendering-Cleaner-HTML.aspx] . No inline styles unless you explicitly do so in markup yourself. * Complete control over ids [http://blog.hmobius.com/post/2010/02/25/ASPNET-Part-8-Introducing-ClientIDMode.aspx] in html. * VS2010 design view window supports CSS2.1. It will also try to interpret correctly invalid CSS selectors (VS issues a warning about the incorrect selector) * Smaller viewstate [http://blog.hmobius.com/post/2010/02/24/ASPNET-Part-7-A-New-Viewstate-Opt-in-Model.aspx] * Semantic URLs with webforms built in routing [http://blog.hmobius.com/post/2010/03/10/ASPNET-40-Part-11-Configuring-Routing-Is-Easier.aspx] . Scott suggested using routing for new apps and using IIS7 Rewriting Module [http://www.iis.net/expand/URLRewrite] for working with older apps. * New meta APIs of pages [http://blog.hmobius.com/post/2010/02/22/ASPNET-40-Part-6-New-Page-Directive-Attributes.aspx] - descriptions and keywords * New Response.Redirect() methods [http://blog.hmobius.com/post/2010/03/04/ASPNET-40-Part-10-A-Handful-Of-Little-Things.aspx] . * New IIS SEO Toolkit Module [http://www.iis.net/expand/SEOToolkit] * New chart control [http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx]
New QueryExtender control works with EntityDataSource and LinqDataSource controls. Enables you to filter database results. (more on QueryExtender here later)

Does the ScriptManager have some sort of internal list of scripts already on the CDN so that when EnableCDN is set to true, it only seeks out jQuery or MS AJAX from the CDNs rather than a developer’s own JS files? Or is there some way to upload your own scripts to a corner of the CDN?

Yes – I believe it does.  It also, though, allows you to add other scripts to the list and/or use alternative CDNs if you want.

Deployment * Config transform files [http://blog.hmobius.com/post/2010/02/17/ASPNET-40-Part-4-Config-Transformation-Files.aspx] - config transform files only work with web app projects and not website projects. * One click Publish mechanism - to file system, via ftp, or using WebDeploy (which also sucks out the sql for the database schema and includes them in the deployment package). * There will be a web deployment package for vs2010 for upgrading projects from vs08 or vs05, but new projects should use the new WebDeploy [http://learn.iis.net/page.aspx/346/web-deploy/] set built into vs2010. WDP2010 may not be released on April 12 with vs2010 but probably by the end of April. * New Package Publish Web step in project properties dialogs. (This is where you can pull the SQL schema and stuff). * Build Deployment Package option which pulls in all files, ACLs and SQL into one zip. * Zip can be published to remote server and populated remotely. * Zip can be imported into IIS. (RHS Actions - Deploy - Import Application) * WebDeploy can be scripted with Powershell. * WebDeploy can be used with asp.net 3.5 * By default it will copy only the files that have changed. * WebDeploy is designed to work with shared hosting.

Final bits * Code Optimized VS10 user profile [http://blog.hmobius.com/post/2010/02/11/ASPNET-40-Part-1-New-Visual-Studio-Code-Optimized-Profiles.aspx] * TFS10 improvements. Significantly easier to set up and configure [http://www.microsoft.com/downloads/details.aspx?FamilyID=2D531219-2C39-4C69-88EF-F5AE6AC18C9F&displaylang=en&displaylang=en] (less than 20 minutes on a clean machine) * Provides integrated team server - source control, bug tracking, automated build server with continuous integration * Now included with all MSDN subscriptions

End of Session One - 12 noon Outside, the weather has turned and mild, grey, overcast Birmingham has turned into mild, grey, wet Birmingham with additional chances of heavier downpours as we go into the afternoon. Campaigners from world vision are apparent by the people avoiding them and those running the taste test for Magnums equally apparent for the opposite reason.

The stay at home mums outside the Odeon are wondering why 200 geeky people keep running in and out of the building.

Pre-session two questions How do you see the relationship between WPF and Silverlight evolve?  WPF has definitely enhanced in 4.0 as part of enhancing VS2010 with WPF. Our goal now is to keep the same programming models in sync between the two. Silverlight and WPF are both governed by the same team so there is a fair amount of cross-pollination between the two.

Is the QueryExtender control built using the dynamic LINQ library shipped earlier?

Yes. 

Will there be a ReMIX 10?

Possibly not, but if so then in September. Certainly in the future.

Session Two - ASP.MET MVC 2 There was heavy focus on emphasizing the new features of MVC 2 in this session, which was mostly demonstration. However, it began with a brief introduction to MVC for those who had not come across it before.

Can you overload an action method with multiple signatures?  Yes, although it’s probably easier to use default parameter values for this and more common to overload action methods by HTTP verb

// get /events/details?eventid = 3 // if not specified, eventid given default value of 0. public string Details(int eventid = 0)

Scott builds a new database. Uses the Entity Framework to create the Model for the database. (File –> New -> EF Data Model).

What if your view contains more than one model?

You create a ViewModel class which encapsulates all the data items to add in and then inherit your view from ViewPage

Strongly-typed html helpers In MVC 1 = Html.TextBox(“FirstName”) would go find the type from the database. In MVC2  = Html.TextBoxFor(m=>m.FirstName) and it will pick up the type from the class. And pick up any renames of class properties which it wouldn’t in MVC 1.

Html.EditorFor(model=>model);

Data annotations Add a Metadata class to Models directory

[MetadataType(typeof(EventMetadata))] public partial class Event { class EventMetadata { [ScaffoldColumn(false)] public int EventId {get; set; }

  [DataType(DataType.MultilineText)]        public string Description { get; set; }     }  } 

Html.EditorFor(model=>model, “nameOfEditorTempalteToUse”);

Validation In MVC “Skinny controllers with fat models”: validation logic into model or service layer - not inside action methods.

class EventMetadata { [Required(ErrorMessage=“You msut specify a name”)] public string EventName {get; set; } }

ActionRendering * Html.Action and Html.RenderAction. * Allows you to encapsulate bits of common UI  with backend processing (a la user controls in webforms). * Create a view - set it as a partial view. Set [ChildActionOnly] on the action method. Then on another view add a call to Html.Action(method, controller);

What’s the difference between this and Html.Partial?

Partial doesn’t do the data modelling stuff.

Areas * Allows to encapsulate Controllers, Models and Views. * Essentially another layer - {area}{controller}{action}.  * You can split out areas across multiple projects but the tooling isn’t entirely there yet.  * Avoid having an area with the same name as a controller not in an area.

Can you scope a Shared folder within an Area folder? Yes

Asynchronous Support In MVC 2 To perform asynchronous operations without blocking the working thread waiting for the response from a long operation.

Unit Testing * TDD support is enhanced in VS10. * You can generate entity template so they don’t derive from EntityObject (and thus no dependence on a database) * Ctrl+Alt+Space toggles Intellisense into “Consume First” mode which stops it aggressively replacing classes and methods you haven’t created yet. Indeed it will even add in references to phantom classes. * Right click on phantom class to generate class and methods. Then let test fail, then make test pass. * Code coverage features included

End of session A massive thanks to Scott [http://weblogs.asp.net/scottgu] for talking and braving the rain, and to Dave [http://blogs.ipona.com/davids] and Phil [http://weblogs.asp.net/plip/] who managed to put on this Guathon and the one in Glasgow at such relatively short notice. It worked a treat.

Posted on April 3, 2010   #Attending Events     #Geek Stuff     #ASP.NET  






← Next post    ·    Previous post →