Category Archives: C# 3.0

Couple of interesting links

  • Brad Abrams writes about “What is .NET RIA Services“. Here is a small bit of this article:

    Microsoft .NET RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. The RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.
  • C# 4.0 goes dynamic – a step too far? Here is a small bit of this article:

    With C# 3.0 still so new that many are only just beginning to appreciate, let alone use, its new features it might seem premature to be discussing the next version of the most popular .NET language. Microsoft, however, has its plans for C# 4.0 well advanced, and the changes are so important that you might not recognise your favourite language after the upgrade. Now is the time to look over the horizon in the hope that end users can influence the outcome.

    The first thing to say is that C# occupies a very special niche in the panoply of .NET languages. When it was introduced there were essentially two classes of Windows programmers corresponding to mastery and use of either VB or C++. The split was fairly clear-cut as VB was easy to learn and easy to use but limited, and C++ was difficult to fathom but could do anything. You can even think of C++ as an object-oriented machine-independent assembly language if you want to, but VB, being interpreted and well removed from machine constructs, was no such thing. In addition there was also the aesthetic distinction to take into account – VB being messy and pragmatic and C++ pure and logical. Of course none of these characterisations is 100% true, they are just approximations to an average truth that is at least recognised by most programmers even if they’d argue over the fine details.

2009 Predictions – ASP.NET, LINQ 2 SQL, VB and C# are dead

These are predictions by Guy Barrette who is Microsoft Regional Director.

ASP.NET is dead
You should drop ASP.NET and start using Silverlight right now because it is clear that Microsoft has no roadmap and future plans for that technology. At the last PDC, nothing new ASP.NET was announced except a few tweaks for AJAX and the fact that Microsoft released the MVC Framework proves that but IMHO, the MVC Framework is just a toy technology to shut the Agile loudmouths that wants to code everything by hand and reinvent the wheel.

BizTalk is dead
With Dublin coming up with the Framework 4.0, it makes no sense to purchase and invest in BizTalk anymore. Why spend gazillions of dollars when you’ll have the exact same services for free right in the Framework? Why being locked with a product when you get the API for free?

LINQ 2 SQL is dead
Microsoft recently stated that they have stopped working on LINQ 2 SQL to focus on the Entity Framework so why would you use LINQ 2 SQL anymore? Once again, Microsoft has released a new technology, people invested in that technology and Microsoft abandoned it without warnings. I’m not happy because I invested so much in LINQ 2 SQL so I think I’ll stick with ADO.NET fearing that Microsoft will eventually dropped the Entity Framework as well.

VB and C# are dead
At the last PDC, Microsoft showed Oslo, its modeling platform along with M, a modeling language. This will revolutionize the way we design and build applications. In the near future we will no longer code using low level languages like VB and C#. I would stop investing in these languages right now and train my whole team in M.

Azure is DOA
Cloud computing, talk about something so stupid its name is stupid. Why the heck would I push my apps and data in Microsoft’s data centers? I don’t get it and I think no one will use that technology and trust Microsoft. This thing is dead even before it will be released (.NET My Services anyone?).

OK, you must have seen similar comments everywhere in forums, blogs or talking with colleagues and other developers but is any of this making sense?

AP.NET vs Silverlight vs MVC Framework
When I was at the last PDC, one thing that struck me was the fact that no major new announcements were made for ASP.NET. Clearly, this is the sign of a mature technology but at the same time, Microsoft is putting a lot of resources and efforts in building a new platform in Silverlight. Does that mean that you should drop ASP.NET? Of course not: it’s mature, it’s stable, hundreds of 3rd party controls are available, it’s proven and you can find thousands of developers familiar with that technology. Why would you stop using it all of a sudden? But why is Microsoft working so hard on Silverlight? Because Silverlight fills the RIA gap in the Microsoft offer because developing complex RIA apps with AJAX is way too costly right now. So why is Microsoft working on the MVC Framework, a direct competitor to ASP.NET? Again, another model to solve different problems. It’s easier to use if you’re deep into TDD, it’s somewhat lighter but at the same time, it’s somewhat a return to Classic ASP. Well, it’s another tool in your .NET toolbox and this creates confusion for people who think in the “one size fits all / one ring to rule them all” way. Again, look at your project/assignment, analyse the problem/need and select the right technology to do the job. But in the long time, could Silverlight be so successful that it would replace ASP.NET? Maybe or maybe not. It certainly has the potential to do so but who knows at this point in time!

2009 prediction: ASP.NET will dominate and we will see a slow but steady Silverlight adoption. The MVC Framework will remain a niche tool for Agilists for now (and I’m not saying this in a pejorative way).

BizTalk vs Dublin
The .NET Framework 4.0 will include a set of extensions to Windows Server that will add new services to Microsoft’s app server. Features that will simplify the deployment, configuration, management, and scalability of WCF and WF applications. Basically, some of the same features found in BizTalk Server. So why would I bother with BizTalk and spend big money when I can get the same services for free? Well, BizTalk is an integration server and Dublin is a set of management tools extending Microsoft app server. Dublin will allow you to deploy more easily your WCF apps so instead of writing a Windows service to host your WCF services, the app server will be able to host them directly.
So you think you can write a BizTalk clone? Remember how BizTalk 1 was a piece of ****? And remember BizTalk 2? Microsoft only got it right with version 3 so yes, you can write a BizTalk clone using Dublin but it will cost you a lot more than purchasing BizTalk because Dublin and BizTalk are two different animals.

2009 prediction: Dublin will be widely used right away to help host WCF apps. BizTalk will not die and some people will get burned by trying to replace BizTalk with Dublin in a scenario where the use of BizTalk would have make more sense. FUD will run loose on the Web.

LINK 2 SQL vs Entity Framework
So Microsoft created some confusion by releasing two similar ORM technologies? Yes of course but if you look closely, they are somewhat similar and different at the same time. LINQ 2 SQL is RAD against SQL Server and the Entity Framework is the full blown ORM thing. Both use LINQ as the query language so if you invested in LINQ 2 SQL, your investment is not wasted and for God’s sake, LINQ 2 SQL is in the Framework; it cannot die!
One suggestion that I saw on the Web was to release LINQ 2 SQL on CodePlex so that people can update it since Microsoft has “abandoned” it. First, Microsoft never said that it has abandoned it. They will keep it as it is right now and they will put all their efforts on the Entity Framework. My hope is that when we’ll see new SQL Server releases, Microsoft will update LINQ 2 SQL to match some of the new features. So back to the CodePlex idea: I think it’s a bad one because people will try to match the features of the Entity Framework or Nhibernate and that will create more confusion because we will have similar products competing against each other.

LINQ 2 SQL = simple 1 to 1 mapping against SQL Server
Entity Framework = complex mapping against SQL Server and more

2009 prediction: people will still be confused and FUD will run loose on the Web

C# and VB vs Oslo
Microsoft have finally abandoned the traditional design surface where we connect little boxes as the way to model apps and I think that Oslo and M are very good concepts. Is this the modeling Holy Grail? I have no idea but it looks good. Can Oslo and M replace VB and C#? Of course not!
Every time that Microsoft launched a new way to model apps, these technologies never lasted more than one version. I would tend to have a wait and see approach. Take a look, experiment and wait for version 2.

2009 prediction: Olso and M will be curiosities. Let’s hope that they will not die as the other Microsoft modelling oddities.

Azure vs apps hosted in the enterprise
Microsoft has taken a bold approach to cloud computing. Instead of hosting your virtual machines running your apps, they will host your apps in a new cloud OS running in their virtual machines. But why would you do that? To drive IT costs down of course. Look, there’s something called a recession going on right now and it’s a nasty one. At some point, your boss will be asked by his/her boss to cut expenses drastically and maybe one way to do it is to go the cloud way. We’ll see but there’s one thing that I’m sure: this will be another tool in your .NET arsenal and it will not make sense to write all apps to run in the cloud. Again, look at your project/assignment, analyse the problem/need and select the right technology to do the job. I’m sure that people will get burned by using the cloud model on projects where it doesn’t make sense.

2009 prediction: Microsoft has a lot of work to do to convince people to move to cloud computing.

Three new free books from Microsoft

Sorry for not writing lately but I have been distracted with some other projects. Here are some interesting books I came across yesterday. Enjoy!

Programming Microsoft® ASP.NET 3.5
ms asp net cvr Three new free books from Microsoft

Programming Microsoft LINQ
ms linq cvr Three new free books from Microsoft

Introducing Microsoft® SilverlightTM 2 Second Edition
ms silverlight cvr Three new free books from Microsoft

Free e-book: Foundations on Programming

book Free e book: Foundations on ProgrammingRecently I found that e-book which might be useful to some of you. Its sub title is: “Building better software” and is written by Karl Seguin.

Here is a link.

Visual Studio 2008 and .NET Framework 3.5 Service Pack 1 Beta

Yes, its coming! The boys and Redmond can’t wait to release all these service packs. I have Scott Guthrie’s blog post in front of me and read it carefully. As for now these two downloads are still in beta but will be released soon in final stage. So far you can download it from here.

There will be some improvements that really concern us. I will closely follow these few:
ASP.NET Data Scaffolding Support (ASP.NET Dynamic Data)
ASP.NET Routing Engine (System.Web.Routing)
ASP.NET AJAX Back/Forward Button History Support
ASP.NET AJAX Script Combining Support
Visual Studio 2008 JavaScript Script Formatting and Code Preferences
Improved ExtJS formatting support!
Application Startup and Working Set Performance Improvements

As well as some Data improvements:
SQL 2008 Support – VS 2008 and .NET 3.5 are being updated to include support for the upcoming SQL 2008 release. Visual Studio 2008 data designers, projects and wizards now fully supporting connecting and working against SQL 2008 databases.
ADO.NET Data Services (formerly code-named “Astoria”)

VB.NET update:
You can now add “XML to Schema” items to Visual Basic projects. On adding these project items a wizard will open that allows you to create a XSD schema set from a variety of XML sources. This schema set is then added to the project and it enables VB XML intellisense.

A XSD browser is also now included with VS 2008 SP1 and allows you to browse XSD schema sets. With the final SP1 release, developers will be able to right-click on XML element names (either in XML properties or XML literals) in the VB code editor and select “Go To XML Schema Definition” – this will open the XSD browser and display the schema set (and select the current element) for the VB project.

C# 3.0 Syntax Additions—Design Guidelines

This is MUST read from every dotNet programmer. It is written by Peter Ritchie on DevX.com and presents the new features of C# 3.0 syntax.

These guidelines will help you understand new additions to C# 3.0 syntax and avoid some of the pitfalls you can encounter when using them.

C# 3.0 includes a few syntactical additions to the language. For the most part, Microsoft added these language additions to support Language Integrated Query (LINQ). These features include (but are not limited to) lambda expressions, extension methods, anonymous types, implicitly typed local variables, automatic properties, and object initializers.

Most of the syntax additions fulfill very specific needs and should not reduce the importance of established coding and design methodologies and guidelines. When in doubt, prefer your established guidelines over the new syntax.

What is covered in his article:

Lambda Expressions
Extension Methods
Anonymous Types
Implicitly Typed Local Variables
Object Initializers
Automatic Properties

All these are presented with nice and small code samples. Read it here.

Free Microsoft Press e-books!

Once again Microsoft brings some knowledge to the masses icon smile Free Microsoft Press e books! This time its free e-books. All the headings speak for them selfs and with few words these books are MUST HAVE for every developer. Only few chapters are included in pdf’s as you are encouraged to buy them! Here is the content:

ms linq cvr Free Microsoft Press e books!Introducing Microsoft LINQ
by Paolo Pialorsi and Marco Russo

ISBN: 9780735623910

* Chapter 1: LINQ Introduction
* Chapter 2: C# Language Features
* Chapter 3: Visual Basic 9.0 Language Features
* Chapter 4: LINQ Syntax Fundamentals
* Chapter 5: LINQ to ADO.NET
* Chapter 6: LINQ to XML

ms ajax cvr Free Microsoft Press e books!Introducing Microsoft ASP.NET AJAX
by Dino Esposito

ISBN: 9780735624139

* Chapter 1: The AJAX Revolution
* Chapter 5: The AJAX Control Toolkit

ms silverlight cvr Free Microsoft Press e books!Introducing Microsoft Silverlight 1.0
by Laurence Moroney

ISBN: 9780735625396

* Chapter 1: Silverlight and User Experience
* Chapter 5: Programming Silverlight with JavaScript

Log into Microsoft Press home page for more info here

ASP.NET Personal Web Site Starter Kit – Ajax Enabled with .NET Framework 3.5 and VS2008

Brad Abrams just converted the existing Web Site Starter Kit from the VS 2005 web site to use the new dot Net 3.5 framework, LINQ and Ajax extenders. Here is the full source code for that.

Here are some of the key points from his post:

– VS2008 Can Target .NET Framework 2.0
– Upgrade to ASP.NET 3.5 and Take Advantage of Linq
– Ajax Enabling the Site
– Tricking out the site with the Ajax Control Toolkit

read the whole post here

Visual Studio 2008 and .NET 3.5 Released

Today Microsoft shipped Visual Studio 2008 and .NET 3.5. You can download the final release using one of the links below:

* If you are a MSDN subscriber, you can download your copy from the MSDN subscription site (note: some of the builds are just finishing being uploaded now – so check back later during the day if you don’t see it yet).

* If you are a non-MSDN subscriber, you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here. A 90-day trial edition of Visual Studio 2008 Professional (which will be a slightly smaller download) will be available next week. A 90-day free trial edition of Team Foundation Server can also be downloaded here.

*If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here.

* If you want to just install the .NET Framework 3.5 runtime, you can download it here.

List of New Featuresold version

VS 2008 Multi-Targeting Support
VS 2008 enables you to build applications that target multiple versions of the .NET Framework. This means you can use VS 2008 to open, edit and build existing .NET 2.0 and ASP.NET 2.0 applications (including ASP.NET 2.0 applications using ASP.NET AJAX 1.0), and continue to deploy these application on .NET 2.0 machines.

ASP.NET AJAX and JavaScript Support
.NET 3.5 has ASP.NET AJAX built-in (no separate download required). In addition to including all of the features in ASP.NET AJAX 1.0, ASP.NET 3.5 also now includes richer support for UpdatePanels integrating with WebParts, ASP.NET AJAX integration with controls like and , WCF support for JSON, and many other AJAX improvements.

VS 2008 Web Designer and CSS Support
VS 2008 and Visual Web Developer 2008 Express includes a significantly improved HTML web designer (the same one that ships with Expression Web). This delivers support for split-view editing, nested master pages, and great CSS integration.

Language Improvements and LINQ
The new VB and C# compilers in VS 2008 deliver significant improvements to the languages. Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code. These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET.

Data Access Improvements with LINQ to SQL
LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5. It enables you to model relational databases using a .NET object model. You can then query the database using LINQ, as well as update/insert/delete data from it. LINQ to SQL fully supports transactions, views, and stored procedures. It also provides an easy way to integrate business logic and validation rules into your data model.

Browsing the .NET Framework Library Source using Visual Studio

Lots of other improvements

The list above is only a small set of the improvements coming. For client development VS 2008 includes WPF designer and project support. ClickOnce and WPF XBAPs now work with FireFox. WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data.

Office development is much richer – including support for integrating with the Office 2007 ribbon, and with Outlook. Visual Studio Tools for Office support is also now built-into Visual Studio (you no longer need to buy a separate product).

New WCF and Workflow projects and designers are now included in VS 2008. Unit testing support is now much faster and included in VS Professional (and no longer just VSTS). Continuous Integration support is now built-in with TFS. AJAX web testing (unit and load) is now supported in the VS Test SKU. And there is much, much more…

Installation Suggestions

People often ask me for suggestions on how best to upgrade from previous betas of Visual Studio 2008. In general I’d recommend uninstalling the Beta2 bits explicitly. As part of this you should uninstall Visual Studio 2008 Beta2, .NET Framework Beta2, as well as the Visual Studio Web Authoring Component (these are all separate installs and need to be uninstalled separately). I then usually recommend rebooting the machine after uninstalling just to make sure everything is clean before you kick off the new install. You can then install the final release of VS 2008 and .NET 3.5 on the machine.

Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the “Reset Settings” option, and then re-pick your preferred profile. This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).

Note that VS 2008 runs side-by-side with VS 2005 – so it is totally fine to have both on the same machine (you will not have any problems with them on the same box).

Silverlight Tools and VS Web Deployment Project Add-Ins

Two popular add-ins to Visual Studio are not yet available to download for the final VS 2008 release. These are the Silverlight 1.1 Tools Alpha for Visual Studio and the Web Deployment Project add-in for Visual Studio. Our hope is to post updates to both of them to work with the final VS 2008 release in the next two weeks. If you are doing Silverlight 1.1 development using VS 2008 Beta2 you’ll want to stick with with VS 2008 Beta2 until this updated Silverlight Tools Add-In is available.

Read Scott Gu

ASP.Net MVC Framework – List and Save data

Today I came across this blog article by Fredrik Normen in which he describes how to list and save data in new MVC Framework.

Here is his part of his post:

When building application today (X)HTML-based web interfaced is often used as the front-end choice today. Several companies used Microsoft SharePoint or other web-based portals solutions as intranet; we have several public applications which are web based. Enterprise applications continue to adopt web-based user interfaces, and this will unlikely change in the near future. A web-based user interface can today target almost any platform, and the deployment of web-based application is much easier than a desktop application that needs to be installed on every client. It’s easier to brand a web application than a desktop application like a Windows Form. A web based application will not take up to much resource on the client’s computer. But there are some challenges also.

The Request-Response paradigm can complicate interactions that would be simple in traditional UI. For example if we have a Windows application we can simply hold the state, HTTP is a stateless protocol which will complicate state management. A web applications user interface today can also be complex, often produced by tools like DreamWeaver and “probably” FrontPage icon wink ASP.Net MVC Framework   List and Save data The applications also often use client-side JavaScript. Some content can be hard to be edited by a .Net developer. But for a designer and of course some developers it’s easy to change the user interface, and often a web applications user interface will be changed. This requires a clean separation of presentation from business logic.
With the ASP.Net MVC Framework we will have separation of concerns. We separate the presentation from the business logic. The MVC is an abbreviation of Model View Controller, where the Controller objects accept user input and invoke business logic to create and update model objects. The Model object has the responsibility to provide the data to display; the model is a contract between controller and view. The View objects are responsible to display the Model, as provided by the controller that invokes it. By using the ASP.Net MVC Framework we will have more control over the HTML (a cleaner HTML page), we will have a controller separated from the View. By having this separation developers can create controllers and use unit-testing or TDD without knowing anything about how the model should be presented. The designer of the User Interface doesn’t need to know about the controller, only what data that should be displayed and sent back during a POST. The three parts in the MVC pattern, the View, Controller and Model can be implemented by three different developers and designer at the same. TDD can be applied when creating the Controllers and also the Model, this because of the separations and the possibility to create mock objects. The MVC Framework works against interface so we have interfaces for everything so we can easy create our mocks and test our controllers without needing to know about the View. We can also mock the Model.

read original