|
|
|
| Related Articles |
| Istanbul property, the future investment trend |
01 January 0001 |
| Istanbul is a real opportunity for global real estate investors, said Kadir Topbas, Istanbul Metropolitan Municipality mayor during the Urban Regeneration and Real Estate Investments Conference |
| |
| Investors In Chinese Real Estate Continue To Face Tax And Accounting Challenges |
02 August 2007 |
| Despite measures by the Chinese government to temper the market, the China real estate market continues to be a significant investment opportunity for both domestic and foreign investors, but the special accounting and taxation of China's real estate market poses a number of challenges to investors, according to business and tax advisors, Deloitte. |
| |
| Hurd says HP's cost structure still too high |
05 March 2007 |
| (InfoWorld) - Despite the turnaround Mark Hurd has engineered at Hewlett-Packard, the president, chairman, and CEO of the technology giant remains unsatisfied.
Hurd said at a Morgan Stanley Technology Conference on Monday in San Francisco that the company still has to reduce its cost structure in order to be more profitable and grow.
By many measures, HP is successful. It edged past rival IBM in 2006 revenue ($91.7 billion to IBM's $91.42 billion), improved its net income by 158 percent over 2005 to $6.2 billion, and is the industry leader in personal computer and blade server sales.
"But on an absolute basis, we're not doing well," Hurd said.
Although HP has been on a two-year campaign of cost reduction, including employee layoffs, those savings are still not completely reflected in HP's profit and loss statement, he said.
"I don't think that we've gotten very good traction with the investment base understanding that these are efforts that require time," Hurd said. "It will take us all of the next two years to be able to take advantage of that."
In an interview before a room full of Morgan Stanley investors, Hurd said the total available worldwide market for the computers, servers, printers, and information technology services HP offers is $1.2 trillion, but that HP still doesn't cover that market effectively. He said the company needs to add to its sales force and develop more partnerships with other companies to better reach customers.
Hurd acknowledged, as he did in the company's earnings conference call Feb. 20, that HP's storage business was weak. It grew only 6 percent in HP's fiscal first quarter, which he attributed to the fact that much of its product line is tape storage, a declining business. However, sales of its EVA line of disk storage products grew 18 percent in the quarter.
As for server sales, while they grew 10 percent overall, sales of blade servers jumped 45 percent in the quarter, and the Integrity line of high-end servers grew by 75 percent.
To further control costs, HP last month offered employees an early retirement opportunity and said it would change from a pension plan to a 401(k) plan, although employees currently in a pension plan will still receive their pensions.
While that is expected to trim payroll costs, Hurd said other costs, such as services delivery, real estate, and procurement, still have to be tightened.
Hurd was one of scores of technology company executives speaking at the technology conference that runs through Wednesday. |
| |
| Visual Studio 2008 and .NET Framework 3.5 Service Pack 1 Beta |
12 May 2008 |
| Earlier today we shipped a public beta of our upcoming .NET 3.5 SP1 and VS 2008 SP1 releases. These servicing updates provide a roll-up of bug fixes and performance improvements for issues reported since we released the products last November. They also contain a number of feature additions and enhancements that make building .NET applications better (see below for details on some of them).
We plan to ship the final release of both .NET 3.5 SP1 and VS 2008 SP1 this summer as free updates. You can download and install the beta here.
Important: SP1 Beta Installation Notes
The SP1 beta released today is still in beta form - so you should be careful about installing it on critical machines. There are a few important SP1 Beta installation notes to be aware of:
1) If you are running Windows Vista you should make sure you have Vista SP1 installed before trying to install .NET 3.5 SP1 Beta. There are some setup issues with .NET 3.5 SP1 when running on the Vista RTM release. These issues will be fixed for the final .NET 3.5 SP1 release - until then please make sure to have Vista SP1 installed before trying to install .NET 3.5 SP1 beta.
2) If you have installed the VS 2008 Tools for Silverlight 2 Beta1 package on your machine, you must uninstall it - as well as uninstall the KB949325 update for VS 2008 - before installing VS 2008 SP1 Beta (otherwise you will get a setup failure). You can find more details on the exact steps to follow here (note: you must uninstall two separate things). It is fine to have the Silverlight 2 runtime on your machine with .NET 3.5 SP1 - the component that needs to be uninstalled is the VS 2008 Tools for Silverlight 2 package. We will release an updated VS 2008 Tools for Silverlight package in a few weeks that works with the VS 2008 SP1 beta.
3) There is a change in behavior in the .NET 3.5 SP1 beta that causes a problem with the shipping versions of Expression Blend. This behavior change is being reverted for the final .NET 3.5 SP1 release, at which time all versions of Blend will have no problems running. Until then, you need to download this recently updated version of Blend 2.5 to work around this issue.
Important Update: If you previously installed a VS 2008 Hotfix, you must run the HotFix Cleanup Utility before installing the VS 2008 SP1 Beta. Click here to download and run this.
Improvements for Web Development
.NET 3.5 SP1 and VS 2008 SP1 contain a bunch of feature improvements targeted at web application development.
The VS Web Dev Tools team has more details (including specific bug fix details) on some of the VS specific work here. Below are more details on some of the work in the web-space:
ASP.NET Data Scaffolding Support (ASP.NET Dynamic Data)
.NET 3.5 SP1 adds support for a rich ASP.NET data "scaffolding" framework that enables you to quickly build functional data-driven web application. With the ASP.NET Dynamic Data feature you can automatically build web UI (with full CRUD - create, read, update, delete - support) against a variety of data object models (including LINQ to SQL, LINQ to Entities, REST Services, and any other ORM or object model with a dynamic data provider).
SP1 adds this new functionality to the existing GridView, ListView, DetailsView and FormView controls in ASP.NET, and enables smart validation and flexible data templating options. It also delivers new smart filtering server controls, as well as adds support for automatically traversing primary-key/foreign-key relationships and displaying friendly foreign key names - all of which saves you from having to write a ton of code.
You can learn more more about this feature from Scott Hanselman's videos and tutorials here.
ASP.NET Routing Engine (System.Web.Routing)
.NET 3.5 SP1 includes a flexible new URL routing engine that allows you to map incoming URLs to route handlers. It includes support for both parsing parameters from clean URLs (for example: /Products/Browse/Beverages), as well as support to dynamically calculate and generate new URLs from route registrations.
This new routing engine is used by both ASP.NET Dynamic Data as well as the new ASP.NET MVC framework. It will support both WebForms and MVC based requests.
ASP.NET AJAX Back/Forward Button History Support
.NET 3.5 SP1 adds new APIs to ASP.NET AJAX to allow you to better control the history list of a browser (enabling you to control the behavior of the back/forward button of the browser).
You can learn more about this feature in the article here and the screencast here.
ASP.NET AJAX Script Combining Support
.NET 3.5 SP1 introduces a new <CompositeScript> element on the <asp:ScriptManager> server control, which allows you to declaratively define multiple script references within it. All the script references within the CompositeScript element are combined together on the server and served as a single script to the client, reducing the number of requests to the server and improving page load time for ASP.NET AJAX applications.
The script combining feature supports both path based scripts and assembly resource based scripts, and dynamically serves up the combined scripts using the ScriptResources.axd handler.
Visual Studio 2008 Performance Improvements HTML Designer and HTML Source Editor
In February we released a HotFix roll-up that included a number of performance improvements and bug fixes for the VS 2008 Web Designer. VS 2008 SP1 includes all of these fixes, as well as a number of additional performance improvements.
Visual Studio 2008 JavaScript Script Formatting and Code Preferences
Visual Studio has for several releases supported rich source code formatting options for VB and C# (spacing, line breaks, brace positions, etc).
VS 2008 SP1 adds richer source code formatting support for JavaScript as well (both inline <script> blocks and .js files). You can now set your Javascript coding preferences using the Tools->Options dialog:
These preferences will be automatically used as you type new Javascript code in the source editor. You can also select existing code, right-click, and choose the "Format Selection" option to apply your style preferences to existing JavaScript code. You can learn more about this new feature here.
Better Visual Studio Javascript Intellisense for Multiple Javascript/AJAX Frameworks
VS 2008 includes Javascript Intellisense support in source view. The intellisense support with the initial VS 2008 release works well with vanilla JavaScript as well as code written using the ASP.NET AJAX JavaScript type patterns. JavaScript is a very flexible language, though, and many JavaScript libraries use this flexibility to full advantage to implement their features - sometimes in ways that prevented the intellisense engine from providing completion support.
VS 2008 SP1 adds much better intellisense support for popular Javascript libraries (we specifically did work to support JQuery, Prototype, Scriptaculous, ExtJS, and other popular libraries). You will get better default intellisense when you reference these libraries. We are also looking at whether we can maintain additional intellisense hint files that you can download to get even better intellisense and documentation support for some of the more popular libraries.
Below is an example of using a JQuery startup function with the VS 2008 SP1 JavaScript intellisense engine:
Notice below how VS 2008 SP1 can now provide method argument completion even on chained JQuery selectors:
Visual Studio Refactoring Support for WCF Services in ASP.NET Projects
VS 2008 SP1 adds better refactoring support for WCF services included within both ASP.NET Web Site and ASP.NET Web Application Projects.
If you use the refactoring support to rename the class name, interface contract, or namespace of a WCF service, VS 2008 SP1 will now automatically fix up the web.config and SVC file references to it.
Visual Studio Support for Classic ASP Intellisense and Debugging
Previous versions of Visual Studio included support for intellisense and debugging within classic ASP (.asp) pages. The file and project templates to create classic ASP pages/projects hasn't been in VS for a few releases, though, and with the initial VS 2008 we incorrectly assumed this meant that people weren't still using the classic ASP support. We heard feedback after we shipped that indeed they were.
With VS 2008 SP1 this support for classic ASP intellisense and debugging is back:
Visual Web Developer Express Edition support for Class Library and Web Application Projects
The Visual Web Developer 2008 Express edition (which is free) is being updated in SP1 to add support for both class library and ASP.NET Web Application project types. Previous versions of Visual Web Developer Express only supported ASP.NET web-site projects.
Among other benefits, the support of class library and web application projects will enable ASP.NET MVC and Silverlight projects to be built with the free Visual Web Developer 2008 Express. All of the above JavaScript, Dynamic Data, Classic ASP, and AJAX improvements work with Visual Web Developer Express as well.
Improvements for Client Development
.NET 3.5 SP1 and VS 2008 SP1 contain major performance, deployment, and feature improvements for building client applications.
Tim Sneath has a great blog post that talks about some of the client improvements here. Below are more details on them:
Application Startup and Working Set Performance Improvements
.NET 3.5 SP1 includes significant performance improvements to the CLR that enable much faster application startup times - in particular with "cold start" scenarios (where no .NET application is already running). Much of these gains were achieved by changing the layout of blocks within CLR NGEN images, and by significantly optimizing disk IO access patterns. We also made some nice optimizations to our JIT code generator that allow much better inlining of methods that utilize structs.
We are today measuring up to 40% faster application startup improvements for large .NET client applications with SP1 installed. These optimizations also have the nice side-effect of improving ASP.NET application request per second throughput by up to 10% in some cases.
New .NET Framework Client Profile Setup Package
.NET 3.5 SP1 introduces a new setup package option for developers building .NET client applications called the ".NET Framework Client Profile". This provides a new setup installer that enables a smaller, faster, and simpler installation experience for .NET client applications on machines that do not already have the .NET Framework installed.
The .NET Framework Client Profile setup contains just those assemblies and files in the .NET Framework that are typically used for client application scenarios. For example: it includes Windows Forms, WPF, and WCF. It does not include ASP.NET and those libraries and components used primarily for server scenarios. We expect this setup package to be about 26MB in size, and it can be downloaded and installed much quicker than the full .NET Framework setup package.
The assemblies and APIs in the .NET Framework Client setup package are 100% identical to those in the full .NET Framework setup package (they are literally the same binaries). This means that applications can target both the client profile and full profile of .NET 3.5 SP1 (no recompilation required). All .NET applications that work using the .NET Client Profile setup automatically work with the full .NET Framework.
A developer can indicate that the client application they are building supports both the .NET Framework Client Profile and the full .NET Framework by pulling up the project properties page for a client application within VS 2008 SP1. Within the project properties page they can select a new checkbox that indicates it only requires those assemblies included in the .NET Framework Client Profile:
VS 2008 will then ensure that the project can only reference those assemblies shipped in the client profile setup package (and it will generate a compile error if you try and use a type in an assembly not included in the client redist). The compiled client application will then run on machines that have both the full .NET Framework installed, as well as machines that only have the .NET Framework Client Profile installed.
If you have a machine that only has the .NET Framework Client Profile installed, and you try and run a .NET application on it that did not mark itself as supporting the .NET Framework Client Profile, then the CLR will refuse to run the application - and will instead prompt the end-user to upgrade to the full .NET Framework package. This ensures that applications always run correctly - and that developers do not need to worry about missing assembly exceptions at runtime if a user tries to run an application that requires the full .NET Framework on a machine that only has the .NET Framework Client Profile installed.
We believe that a large class of .NET client applications will be able to use this new .NET Client Profile setup to significantly speed up their installation, and enable a much more consumer friendly experience.
New .NET Framework Setup Bootstrapper for Client Applications
.NET 3.5 SP1 introduces a new "bootstrapper" component that you can use with client applications to help automate making sure that the right version of the .NET Framework is installed.
The bootstrapper component can handle automatically downloading and installing either the .NET Framework Client Profile or the full .NET Framework Setup Package from the Internet if your machine doesn't have either of them installed. The boostrapper can also automatically handle upgrading machines that have a previous version of the .NET Framework installed. For example, if your machine already has .NET 3.0 installed, and your application requires .NET 3.5, the bootstrapper can optionally download just the update files needed to upgrade it to .NET 3.5 (and avoid having to download the full .NET Framework setup download).
The setup bootstrapper component can be used with both ClickOnce based setup packages, as well as with third party installer products (like Installshield). The boostrapper optionally enables fully customized setup branding experiences (splash screens, custom setup wizard steps, etc) and should make it much easier to build optimized client setup experiences.
ClickOnce Client Application Deployment Improvements
.NET 3.5 SP1 includes several improvements for ClickOnce deployment of both Windows Forms and WPF applications. Some of these improvements include:
Support for the .NET Framework Client Profile (all ClickOnce features are supported with it)
ClickOnce applications can now be programmatically installed through a ‘Setup.exe’ while displaying a customized, branded install UX
ClickOnce improvements for generating MSI + ClickOnce application packages
ClickOnce error dialog boxes now support links to application specific support sites on the Web
ClickOnce now has design-time support for setting up file associations
ClickOnce application publishers can now decide to opt out of signing and hashing the ClickOnce manifests as they see appropriate for their scenarios.
Enterprises can now choose to run only Clickonce Applications Authenticode signed by ‘Known Publishers’ and block anything else from running
FireFox browser extension to support Clickonce installations using FireFox browsers
Windows Forms Controls
SP1 adds several new Windows Forms controls - including new vector shape, Printing, and DataRepeater controls:
WPF Performance Improvements
.NET 3.5 SP1 includes several significant performance optimizations and improvements to WPF. Some of the specific graphics improvements include:
Smoother animations
Hardware accelerated rendering of Blur and DropShadow Bitmap Effects
Text Rendering speed improvements - especially with VisualBrish and 3D scenes
2D graphics improvements - especially with z-index scenarios
A new WriteableBitmap class that enables real-time and tear-free bitmap updates. This enables custom "paint"-style applications, data visualizations, charts and graphs that optionally bypass the default WPF 2D graphics APIs.
Layered window performance improvements
SP1 also adds support for better data scalability in WPF. The ListView, ListBox and TreeView controls now support "item container recycling" and "virtualization" support which allows you to easily achieve a 40% performance improvement with scrolling scenarios. These controls also now optionally support a "deferred scrolling" feature which allows you to avoid scrolling in real time and instead wait until a user releases the scroll thumb (the default scrolling mode in Outlook). This can be useful when scrolling over very large data sets quickly.
WPF Data Improvements
.NET 3.5 SP1 includes several data binding and editing improvements to WPF. These include:
StringFormat support within {{ Binding }} expressions to enable easy formatting of bound values
New alternating rows support within controls derived from ItemsControl, which makes it easier to set alternating properties on rows (for example: alternating background colors)
Better handling and conversion support for null values in editable controls
Item-level validation that applies validation rules to an entire bound item
MultiSelector support to handle multi-selection and bulk editing scenarios
IEditableCollectionView support to interface data controls to data sources and enable editing/adding/removing items in a transactional way
Performance improvements when binding to IEnumerable data sources
WPF also now exposes hooks that enable developers to write custom panels w/ virtualized scrolling. We'll be using this support together with the above data binding improvements to build the new WPF datagrid that will be shipping later this year.
WPF Extensible Shader Effects
.NET 3.5 SP1 adds support in WPF for a new shader effects architecture and API that allows extremely expressive visual effects to be created and applied to any control or element within WPF. These shader effects support blending multiple input compositions together. What makes them particularly powerful is that WPF executes effects (including custom effects you build yourself) using the GPU - giving you fully hardware accelerated graphics performance. Like almost everything in WPF, you can also use WPF databinding and animation on the properties of an effect (allowing them to be fully integrated into an experience).
Applying an effect onto a Control is super easy - just set a Control's "Effect" property. For example, to add a hardware accelerated drop-shadow effect on a button you can use the built-in <DropShadowEffect> on it via either code or XAML:
Which will cause the button to render like so:
Because Effects are extensible, developers can create their own custom Effect objects and apply them. For example, a custom "DirectionalBlurEffect" could be created and added to a ListBox control to change its scroll appearance to use a blur effect if you rapidly scroll across it:
Keep an eye on Greg Schechter's blog to learn more about how the Effects architecture works and to learn how you can both create and apply new effects within your applications (his first set of posts are here).
Note: In addition to introducing the new Shader Effects API, WPF in SP1 also has updated the existing Blur and DropShadow Bitmap effects already in WPF to be hardware accelerated.
WPF Interoperability with Direct3D
.NET 3.5 SP1 adds support to efficiently integrate Direct3D directly into WPF. This gives you more direct access to the hardware and to take full advantage of the Direct3D API within WPF applications. You will be able to treat Direct3D content just like an image within an application, as well as use Direct3D content as textures on WPF controls.
For example, below are three samples from the Direct3D SDK:
We could either load them in as image surfaces within a WPF application, or map them as textures on WPF controls. Below is an example of mapping them as textures onto cubes in a WPF 3D application:
Note: the Direct3D integration isn't today's SP1 beta release. It will appear in the final SP1 release.
VS 2008 for WPF Improvements
VS 2008 SP1 includes several significant improvements for WPF projects and the WPF designer. These include:
Several performance improvements
Events tab support within the property browser
Ability to sort properties alphabetically in the property browser
Margin snaplines which makes form layout much quicker
Better designer support for TabControl, Expander, and Grid
Code initiated refactoring now updates your XAML (including both control declarations and event declarations in XAML)
Go to Definition and Find All References now support things declared in XAML
The debugger has also been updated in SP1 so that runtime errors in XAML markup (for example: referencing styles, datasources and/or other objects that don't exist) will now be better identified within the debugger:
Data Development Improvements
.NET 3.5 SP1 and VS 2008 SP1 include a bunch of improvements for data development. Some of them include:
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 Entity Framework and LINQ to Entities:
.NET 3.5 SP1 includes the new ADO.NET Entity Framework, which allows developers to define a higher-level Entity Data Model over their relational data, and then program in terms of this model. Concepts like inheritance, complex types and relationships (including M:M support) can be modeled using it. VS 2008 SP1 now includes built-in designer support to help with this modeling:
The ADO.NET Entity Framework and the VS 2008 Entity Framework Designer both support a pluggable provider model that allows them to be used with any database (including Oracle, DB2, MySql, PostgreSQL, SQLite, VistaDB, Informix, Sybase, and others).
Developers can then use LINQ and LINQ to Entities to query, manipulate, and update these entity objects.
ADO.NET Data Services (formerly code-named "Astoria")
.NET 3.5 SP1 includes a flexible framework that enables the creation of REST-based data services. Formerly code-named "Astoria", the ADO.NET Data Services framework provides support for publishing data through a standard REST URI syntax and using standard HTTP verbs to operate on the data resources. Developers can easily expose data models created using the ADO.NET Entity Framework, and/or use a pluggable provider model to expose other data models.
In addition to publishing data sources, the framework also adds a client API for working with remote REST services. Included with this client API is a LINQ library that allows the remote query of REST services.
WCF Development Improvements
.NET 3.5 SP1 and VS 2008 SP1 include several enhancements for WCF development. Some of these include:
Significant scalability improvements (5-10x) in Web-hosted application scenarios
Support for using ADO.NET Entity Framework entities in WCF contracts
API usability improvements with DataContract Serializers, and with the UriTemplate and WCF web programming models
Enhanced TestClient support within VS 2008 SP1
New Hosting Wizard in VS 2008 SP1 for WCF Service Projects
Improved debugging support in partial trust scenarios
VB and C# Improvements
The VB and C# teams have also added some nice improvements to VS 2008 SP1:
Visual Basic
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. This support was previously available as a web download - you can learn more about it here.
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#
The C# code editor now identifies and displays red squiggle errors for many semantic code issues that previously required an explicit compilation to identify. For example, if you try to declare and use an unknown type in the C# code-editor today you won't see a compile error until you do a build. Now with SP1 you'll see live red squiggle errors immediately (no explicit compile required):
The debugger in VS 2008 SP1 has also been improved to provide more debugging support for evaluating LINQ expressions and viewing results at debug time:
LINQ enabled data sources now have a "Results View" node show up within the debugger watch window. Expanding this node will evaluate a LINQ expression and allow you to examine the materialized objects it returns:
Team Foundation Server Improvements
TFS 2008 SP1 includes a ton of improvements. Please read Brian Harry's Team Foundation Server 2008 SP1 Preview blog post for more details.
Summary
.NET 3.5 SP1 and VS 2008 SP1 provide a bunch of bug fixes, performance improvements, and additional feature enhancements that make building all types of .NET applications better. It will be a fully compatible service pack release.
We plan to ship the final release of both .NET 3.5 SP1 and VS 2008 SP1 this summer as free updates. You can download and use the beta now here.
Hope this helps,
Scott |
| |
| ASP.NET MVC Source Refresh Preview |
17 April 2008 |
| We recently opened up a new ASP.NET CodePlex Project that we will be using to provide previews (with buildable source code) for several upcoming ASP.NET features and releases. Last month we used it to publish the first drop of the ASP.NET MVC source code. This first drop included the source for the ASP.NET MVC Preview 2 release that we shipped at MIX, along with Visual Studio project files to enable you to patch and build it yourself. A few hours ago we published a refresh of the ASP.NET MVC source code on the site. This source refresh is not an official new ASP.NET MVC preview release - instead it is an interim drop that provides a look at the current state of the source tree. We will ship the official "ASP.NET MVC Preview 3" release in a few weeks after we finish up some more work (more features and tweaks to existing ones, better VS tool integration, VS express edition support, documentation, etc). If you are someone who wants a hassle-free installation of ASP.NET MVC to use that ships with documentation and full tool support you'll probably want to wait for this official preview release. If you are someone who wants a chance to see an early "preview of the preview" and have the opportunity to start using and giving feedback on some of the features immediately, today's source refresh is probably interesting to look at. Improvements with this ASP.NET MVC Source Refresh This week's update (which you can download here) includes a number of improvements to ASP.NET MVC. Some of these include: In addition to posting the source code for the ASP.NET MVC framework, we are also posting the source code for the unit tests that we use to test it. These tests are implemented using MSTest and the open source Moq mocking framework. A VS 2008 project file for the unit tests is included to make it easy to build and run them locally within your VS 2008 IDE. Significantly easier support for testing Controller classes. You can now unit test common Controller scenarios without having to mock any objects (more details on how this works below). Several nice feature additions and usability improvements to the URL routing system (more details below). Creating a New ASP.NET MVC Project You can build your own copy of the ASP.NET MVC assemblies by downloading the MVC source and compiling it locally, or alternatively you can download a VS Template package to get a pre-built version of them along with a Visual Studio project template that you can use to quickly build a new ASP.NET MVC Project that uses the latest bits. After you install the ASP.NET MVC source refresh .VSI template, a new "ASP.NET MVC Application" project template will show up under the "My Templates" section of your "New Project" dialog: This new "My Templates" version of the MVC project template lives side-by-side with the previous ASP.NET MVC Preview 2 release (which you can see above it in the main project templates section of the dialog). This allows you to safely create new projects and and use both the latest source version and the last official preview version on the same machine. When you create a new project using this updated ASP.NET MVC Project template you'll by default get a project that looks like below: This new project solution contains one Controller ("HomeController") under the "\Controllers" directory and two View templates ("About" and "Index") under the "\Views\Home" sub-directory. Both view templates are based on a common master page for the site ("Site.master"), all of whose styles are defined within a "Site.css" file under the "\Content" directory. When you run the application the built-in web-server will automatically start up and you'll see the site's "Home" content: Clicking the "About us" tab will then display the "About" content: The "HomeController" class in the project is responsible for handling both of the URLs above and has two action methods like below: The default "Site.master" template looks for a "Title" value in the ViewData collection and uses it to render the <title> element of the HTML page. The default "Index" view template looks for a "Message" value and uses it to render the home page's welcome message. You can obviously go in and customize these files however you want. Controller Changes with this ASP.NET MVC Drop If you were reading the above code closely you might have noticed a few changes with how Controller classes are by default implemented using this new ASP.NET MVC source refresh drop. With the ASP.NET MVC Preview 2 release the above HomeController action methods would have instead been implemented like below: The MVC feature team is experimenting with a few ideas in this week's drop and are trying out some new ideas: Action methods on Controllers now by default return an "ActionResult" object (instead of void). This ActionResult object indicates the result from an action (a view to render, a URL to redirect to, another action/route to execute, etc). The RenderView(), RedirectToAction(), and Redirect() helper methods on the Controller base class now return typed ActionResult objects (which you can further manipulate or return back from action methods). The RenderView() helper method can now be called without having to explicitly pass in the name of the view template to render. When you omit the template name the RenderView() method will by default use the name of the action method as the name of the view template to render. So calling "RenderView()" with no parameters inside the "About()" action method is now the same as explicitly writing "RenderView('About')". It is pretty easy to update existing Controller classes built with Preview 2 to use this new pattern (just change void to ActionResult and add a return statement in front of any RenderView or RedirectToAction helper method calls). Returning ActionResult Objects from Action Methods So why change Controller action methods to return ActionResult objects by default instead of returning void? A number of other popular Web-MVC frameworks use the return object approach (including Django, Tapestry and others), and we found for ASP.NET MVC that it brought a few nice benefits: It enables much cleaner and easier unit testing support for Controllers. You no longer have to mock out methods on the Response object or ViewEngine objects in order to unit test the response behavior of action methods. Instead, you can simply assert conditions using the ActionResult object returned from calling the Action method within your unit test (see next section below). It can make Controller logic flow intentions a little clearer and more explicit in scenarios where there might be two different outcomes depending on some condition (for example: redirect if condition A is true, otherwise render a view template it is false). This can make non-trivial controller action method code easier to read and follow. It enables some nice composition scenarios where a FilterActionAttribute can take the result of an action method and modify/transform it before executing it. For example: a "Browse" action on a ProductCatalog controller might return an RenderActionResult that indicates it wants to render a "List" view of products. A FilterActionAttribute declaratively set on the controller class could then have a chance to customize the specific "List" view template rendered to be either List-html.aspx or List-xml.aspx depending on the preferred MIME type of the client. Multiple FilterActionAttributes can also optionally be chained together to flow the results from one to another. It provides a nice extensibility mechanism for people (including ourselves) to add additional features in the future. New ActionResult types can be easily created by sub-classing the ActionResult base class and overriding the "ExecuteResult" method. It would be easy to create a "RenderFile()" helper method, for example, that a developer writing an action could call to return a new "FileActionResult" object. It will enable some nice Asynchronous execution scenarios in the future. Action methods will be able to return an AsyncActionResult object which indicates that they are waiting on a network operation and want to yield back the worker thread so that ASP.NET can use it to execute another request until the network call completes. This will enable developers to avoid blocking threads on a server, and support very efficient and scalable code. One of the goals with this interim preview is to give people a chance to play around with this new approach and do real-world app-building and learning with it. We will also post an alternative Controller base class sample that you can use if you still prefer the previous "void" action return approach. We deliberately didn't include this alternative Controller base class in this source refresh drop, though, because we want to encourage folks to give the "ActionResult" return approach a try and send us their app-building feedback on it. How To Unit Test Controller Action Methods I mentioned above that the new ActionResult approach can make unit testing controllers much easier (and avoid the need to use mocking for common scenarios). Let's walk through an example of this in action. Consider the simple NumberController class below: This Controller class has an "IsEvenNumber" action method that takes a number as a URL argument. The IsEvenNumber action method first checks whether the number is negative - in which case it redirects the user to an error page. If it is a positive number it determines whether the number is even or odd, and renders a view template that displays an appropriate message: Writing unit tests for our "IsEvenNumber" action method is pretty easy thanks to the new ActionResult approach. Below is an example unit test that verifies that the correct Http redirect occurs when a negative number is supplied (for example: /Number/IsEvenNumber/-1): Notice above how we did not need to mock any objects to test our action method. Instead we simply instantiated the NumberController class and called the action method directly (passing in a negative number) and assigned the return value to a local "result" variable. I used the C# "as type" syntax above to cast the "result" variable as a strongly typed "HttpRedirectResult" type. What is nice about the C# "as" keyword is that it will assign the value as null instead of throwing an exception if the cast fails (for example: if the action method returned a RenderViewResult instead). This means I can easily add an assertion check in my test to verify that the result is not null in order to verify that an Http redirect happened. I can then add a second assertion check to verify that the correct redirect URL was specified. Testing the scenarios where non-zero numbers are passed in is also easy. To do this we'll create two test methods - one testing even numbers and one testing odd numbers. In both tests we'll assert that a RenderViewResult was returned, and then verify that the correct "Message" string was passed within the ViewData associated with the view: We can then right click on our NumberControllerTest class inside VS 2008 and choose the "Run Tests" menu item: This will execute our three unit tests in-memory (no web-server required) and report back on whether our NumberController.IsEvenNumber() action method is performing the right behavior: Note: with this week's source drop you still need to use mocking to test the TempData property on Controllers. Our plan is to not require mocking to test this with the ASP.NET MVC Preview 3 drop in a few weeks. MapRoute Helper Method URL routing rules within ASP.NET MVC applications are typically declared within the "RegisterRoutes" method of the Global.asax class. With ASP.NET MVC Previews 1 and 2 routes were added to the routes collection by instantiating a Route object directly, wiring it up to a MvcRouteHandler class, and then by setting the appropriate properties on it to declare the route rules: The above code will continue to work going forward. However, you can also now take advantage of the new "MapRoute" helper method which provides a much simpler syntax to-do the same thing. Below is the convention-based URL route configured by default when you create a new ASP.NET MVC project (which replaces the code above): The MapRoute() helper method is overloaded and takes two, three or four parameters (route name, URL syntax, URL parameter default, and URL parameter regular expression constraints). You can call MapRoute() as many times as you want to register multiple named routes in the system. For example, in addition to the default convention rule, we could add a "Products-Browse" named routing rule like below: We can then refer to this "Products-Browse" rule explicitly within our Controllers and Views when we want to generate a URL to it. For example, we could use the Html.RouteLink view helper to indicate that we want to link to our "Products-Browse" route and pass it a "Food" category parameter using code in our view template like below: This view helper would then access the routing system and output an appropriate HTML hyperlink URL like below (note: how it did automatic parameter substitution of the category parameter into the URL using the route rule): Note: with this week's source drop you need to pass-in the controller and action parameters (in addition to the Category param) to the Html.RouteLink() helper to resolve the correct route URL to generate. The ASP.NET MVC Preview 3 drop in a few weeks will not require this, and allow you to use the Html.RouteLink call exactly as I've written it above to resolve the route. Other URL Route Mapping Features This week's MVC source drop also supports a bunch of new URL route mapping features. You can now include "-", ".", ";" or any other characters you want as part of your route rules. For example, using a "-" separator you can now parse the language and locale values from your URLs separately using a rule like below: This would pass appropriate "language", "locale", and "category" parameters to the ProductsController.Browse action method when invoked: URL Route Rule Example URL Parameters Passed to Action method {language}-{locale}/products/browse/{category} /en-us/products/browse/food language=en, locale=us, category=food /en-uk/products/browse/food language=en, locale=uk, category=food Or you can use the "." file extension type at the end of a URL to determine whether to render back the result in either a XML or HTML format: This would pass both "category" and a "format" parameters to the ProductsController.Browse action method when invoked: URL Route Rule Example URL Parameters Passed to Action method products/browse/{category}.{format} /products/browse/food.xml category=food, format=xml /products/browse/food.html category=food, format=html ASP.NET MVC Preview 2 introduced wildcard route rules. For example, you can indicate in a rule to pass all remaining URI content on as a named parameter to an action method: This would pass a "contentUrl" parameter to the WikiController.DisplayPage action method when invoked: URL Route Rule Example URL Parameters Passed to Action method Wiki/Pages/{*contentUrl} /Wiki/Pages/People/Scott contentUrl="People/Scott" /Wiki/Pages/Countries/UK contentUrl="Countries/UK" These wildcard routes continue to work fine with this week's preview - and are very useful to look at if you are building a blogging, wiki, cms or other content based system. Note that in addition to using the new routing system for ASP.NET MVC scenarios, we are also now using the same routing system within ASP.NET Dynamic Data (which uses ASP.NET Web Forms). Summary Hopefully the above post provides a quick update on some of the new features and changes exposed with this week's ASP.NET MVC source update drop. You can download it here if you want to start using it immediately. Alternatively, you can wait a few weeks for the official ASP.NET MVC Preview 3 drop - which will have some more features (and incorporate feedback people provide on this week's drop), deliver a more seamless installer, provide nice VS integration, and deliver up to date documentation. For any questions/issues with this week's drop of ASP.NET MVC, make sure to also check out the ASP.NET MVC forum on www.asp.net. Hope this helps, Scott |
| |
| More airlines will fail, warns aviation expert |
29 September 2008 |
| [Hits:1294] Advantage Conference Report: 'Low-cost airlines are in real distress', agents told |
| |
| Ryanair transatlantic plans re-emerge |
25 September 2008 |
| [Hits:1828] Opportunity created by turmoil in airline sector |
| |
| Convention must be a catalyst for real change |
06 October 2008 |
| Convention Comment by Paul Riches, youtravel.com sales and marketing director |
| |
| Stella deal provides opportunity for Advantage |
28 November 2007 |
| ABTA Travel Convention special report: Deals with suppliers could be renegotiated |
| |
| SIMSEK SPEAKS AT MENA-OECD MEETING |
01 January 0001 |
| CAIRO (A.A) - Turkish State Minister Mehmet Simsek said on
Wednesday that 20 billion USD direct international investment that came to Turkey
last year was around 20 times more than the average of 1980's and 1990's. |
| |
 |
|
|
|