Wednesday, April 21, 2010

VS 2010 Links from Central PA .NET presentation

Visual Studio 2010 Intros



  • Link to code(CPADemo.zip) from Entity Framework Demo with POCOs (Plain Old CLR Objects)
  • CodeCamp Philly 2010 with webcast downloads to Judy's presentation and EF presentation

  • Scott Wiltamuth Apr 26 at 5:30 Microsoft Malvern

  • Public Sector Road Show in Harrisburg May 5 Overall look at VS 2010 + focus on team system

  • Visual Studio Editing features
    MSDN article

    Note: Control-Alt-Spacebar to switch between completion and suggestion mode

  • Free e-book on moving to Visual Studio 2010


More detailed links



Entity Framework 4.0 New Feature Summary


    EF 4 new features
  • POCO support and Proxies

  • Lazy/Deferred Loading

  • Foreign Keys

  • ObjectSet and Testability

  • Model First/Database Generation

  • LINQ to Entities Improvements

  • Pluralization

  • Stored procedures that return complex types

  • Provider changes, including support for Date/Time, Math, and Provider Supplied Functions

  • ExecuteStoreQuery, Translate



Entity Framework Resources



EF and POCO



  • Microsoft-created templates are downloadable through gallery OR here

  • POCO template walkthrough

  • 4 part POCO walkthrough: 1 2 3 4


Tuesday, April 20, 2010

Farewell code access security policy (and others things deprecated in .NET 4.0)

At this writing, Microsoft is still has a lot of work to do in articulating their revamped security model. Here is what I gather from what 2 Microsoft employees involved in CLR security: Andrew Dai and Shawn Farkas. CAS policy is being deprecated in favor of Level 2 Security Transparency. Non-hosted applications, e.g. a WinForms app, will be fully trusted when run locally or over the local network. Microsoft is recommending use of policy be implemented and managed outside of the CLR itself. Hosted applications such as in ASP.NET will still have the ability to run as a partially trusted application. In essence Microsoft is trying to simplify the security model. In the end, I think a more understandable model will be utilized more. As an ASP.NET developer I hope to see more ASP.NET applications running as partially trusted in the future.


Surprisingly, ASP.NET Ajax client side libraries are deprecated. Microsoft is open sourcing its Ajax client library and making JQuery the “the primary way to develop client-side Ajax applications using Microsoft technologies.” This come from a post on Stephen Walther’s blog. I think this is a great decision, having long favored JQuery myself. Given all of Microsoft’s efforts in creating its Ajax library , switching to JQuery is also a ballsy decision.


Microsoft continues to publicly support WebForms and MVC but a closer look at the new features in each suggests otherwise. MVC has new features like Areas, data annotations, and asynchronous controllers. In web forms, allowing developers control over the ID of form fields when using server controls is a huge deal. It was a frustrating experience to deal with the ID mangling done previously. Greater control over viewstate is another very useful change. Having server controls emit clean css-based markup is also important. I see these as bugfixes, not the introduction of new features. True new features are basically absent within WebForms.
There is a lot of exciting stuff in .NET 4.0 but it is always interesting to see what the casualties are.

Major Themes emerging from the VS 2010 Launch

Amidst the bevy of new features, a few major themes emerge in the release. C# and VB.NET changes are primarily designed to add features that already existed in its sibling language. Dynamic support has been added to C# and VB.NET and a production release of the DLR with IronPython and IronRuby has come as well. VS 2010’s much talked about conversion to being a WPF application shows that Microsoft is preparing WPF to be the primary desktop software. Finally, software parallelism is featured in numerous areas, notably the available of F# as a fully supported functional programming language.



Microsoft has had numerous teams and research projects focus on parallelism related technologies. Including F# “in the box” with VS 2010 provides a functional language within the family of .NET framework languages. Functional languages are considered well suited for splitting logic across multiple CPUs. Having fewer or no side effects, as functional languages are oriented around, allows program instructions to be more easily scheduled across CPUs. For multi-threaded processing, Microsoft has provided a new library called tasks. Tasks offer a simplified approach to using thread pools that also allowing greater control over such things as aborting a task.
WPF and its sibling Silverlight appear to be the focus in rich UI technologies, finally pushing WinForms aside. There is little new on the WinForms front. WPF is plugging availability holes (relative to WinForms) in its array of controls. WPF offers a databound grid for the first time. WPF and Silverlight both benefit from a new, shared XAML designer. Since VS 2010 is built using WPF and the VS and WPF teams collaborated closely, his has meant many WPF performance improvements. I think that this will give Microsoft the courage to finally officially deprecate WinForms with the next major VS release.


Microsoft’s linguistic emphasis in VS 2010 for VB.NET and C# is to make the two languages comparable in features. For C#, this means features that are important in COM interop scenarios and Office-related programming in particular. These features include named parameters, optional parameters, and late binding. For VB.Net, this includes full support for lambdas. This includes multiline lambdas and lambdas that don’t return a value.


Dynamic language features have finally made it as a fully supported part of .NET. The Dynamic Language Runtime (DLR) is a layer that exists on top of the CLR. Both VB.NET and C# allow ways to specify the use of dynamic typing. The .NET based dynamic languages IronRuby and IronPython are now available, although not directly provided by Visual Studio (separate downloads are available). Interop between Ruby or Python and VB.NET or C# is available plus VB.NET and C# can host a Python or Ruby scripting engine.

Wednesday, April 7, 2010

Reflections on J.P.’s Nothing But Net Course

I took JP’s course in 2008 in Philadelphia and found it to be the most valuable but most draining course I have ever taken. By my nature, I am not somebody who will survive a boot camp of ANYTHING well. It also takes me a long time for me to absorb things. It is important to note that J.P. has announced plans to cut back from days that run until 2 or 3 in the morning to ending by 10 pm. I think it has taken me about 18 months but, I have finally absorbed most of the course. I still have some work to do in grokking Behavior Driven Design. During the class I made reference to the students as “Boodhoosattvas”. A bodhisattava is an enlightened learner on the way to Buddhahood. J.P. is an inspiring teacher encouraged his students to become a continuously evolving (and continuously integrated :) )passionate developer.


One key takeaway from the course was the concept of developing a solid core of knowledge. For me, focusing on Domain Driven Design through the work of Eric Evans (one of JPs recommendations) has been an area of focus for me. The idea of an ubiquitous shared language between users and developers has been a key tenet in my efforts to do stealth agile development. Evans focus on container shipping as a system example worked great for me, since I worked on a system that involves booking container shipments. I probably have taken even more, though, from some of Evans’ post-book webcasts that cover strategic design. Often forgotten amidst the tactical design DDD topics of value objects, repositories, and aggregate roots are some real wisdom in Evans’ approach to strategic design. Another pair of books that I have focused on are Jon Skeet’s C# in Depth and Jeffrey Richter’s CLR via C#.


Another thing J.P covered is how to develop a reputation as a developer. He encouraged the class to blog and work on presenting at user groups. I have started blogging this year and have my first user group presentation in a couple of weeks.


A third important takeaway was to take a broader view of a developer community. A great deal of the course is spent working with different groupings of fellow students. Prior to the course, I had been somewhat isolated from a sense of a developer community apart from the 7 or so people directly on my development team. In my own little community, I was content to dominate the discussion without any real technical debate or challengers. This week broadened my developer world view tremendously.


A fourth, very specific, takeaway was to embolden my renounciation of WebForm development. JP criticized WebForms development in favor of pattern-based approaches in the ballpark of the Model View Controller pattern. This has given me the kind of expert opinion and intellectual support for me to pursue the goal of eliminating WebForm server control based pages from the applications I work on.


This reflection really doesn’t relate to specific coverage of topics, although I can assure you that JP did cover the very ambitious syllabus in the course. I also blog about one approach he utilized to represent type-safe enums here.

Article Posted on Handling Http Form Data in ASP.NET

Just a quick note that I have placed an article here on a utility class for handling http form data. The idea is to allow you to treat post or get data in a consistent manner for both retrieval and generation of data. It incorporates UrlEncoding and HtmlEncoding as appropriate to allow you to output sanitized code without dwelling on the details. The class allows you to treat as a writeable dictionary so that entries can be added or deleted as needed. You could probably write most of the code from this description, it is that simple. However, I do illustrate a solution to pass data of one's choice when making a Server.Transfer call.


In ASP.NET, Server.Transfer will either pass exactly the same data that the initial page received or no data at all. I use Thread Local Storage (TLS) to store a representation of form data. If you aren't familiar with it, TLS is an extremely useful feature within Windows that allow data storage on a per-thread basis. It is used to provide under the hood support for many cool features within and beyond .NET. An example feature is the idea of an ExecutionContext, which is actually patented by Microsoft.