31,19 €
With about ten years since its first release, Microsoft's .NET Framework 4.5 is one of the most solid development technologies to create casual, business, or enterprise applications. It has evolved into a very stable framework and solid framework for developing applications, with a solid core, called the CLR (Common Language Runtime) Microsoft .NET Framework 4.5 includes massive changes and enables modern application and UI development."Microsoft .Net Framework 4.5 Quickstart Cookbook" aims to give you a run through the most exciting features of the latest version. You will experience all the flavors of .NET 4.5 hands on. The “How-to” recipes mix the right ingredients for a final taste of the most appetizing features and characteristics. The book is written in a way that enables you to dip in and out of the chapters.The book is full of practical code examples that are designed to clearly exemplify the different features and their applications in real-world development. All the chapters and recipes are progressive and based on the fresh features on .NET Framework 4.5.The book will begin by teaching you to build a modern UI application and improve it to make it Windows 8 Modern UI apps lifecycle model-compliant. You will create a portable library and throttle data source updating delays. Towards the end of the book, you will create you first Web API.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 192
Veröffentlichungsjahr: 2013
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2013
Production Reference: 1140513
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84968-698-3
www.packtpub.com
Cover Image by Artie Ng (<[email protected]>)
Author
Jose Luis Latorre Millas
Reviewers
Stephen Cleary
Layla Driscoll
Nauzad Kapadia
Leon Welicki
Ariel Woscoboinik
Acquisition Editor
Joanne Fitzpatrick
Lead Technical Editor
Dayan Hyames
Technical Editors
Chirag Jani
Soumya Kanti
Veena Pagare
Copy Editors
Insiya Morbiwala
Aditya Nair
Laxmi Subramanian
Project Coordinator
Amey Sawant
Proofreader
Lawrence A. Herman
Indexer
Rekha Nair
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph
Jose Luis Latorre Millas is a Microsoft Silverlight MVP, Toastmaster's Competent Communicator, TechEd speaker, INETA speaker, STEP member, trainer, technical writer, and reviewer. He is deeply involved with the technical communities through his collaboration with INETA Europe, Barcelona Developers, and other communities and user groups. He recently co-founded the Zurich .NET Developers user group at Zurich, Switzerland, which can be found at http://ZurichDev.net.
Jose Luis Latorre is strongly focused on XAML technologies such as Windows Store Apps, Windows Phone Apps, Silverlight, and WPF. He has written several articles on these topics, reviewed books, and worked with and given several talks over the last few years on these areas of knowledge.
Jose Luis works as UI Team Lead developer at Roche Diagnostics, where he does his best to develop and improve diagnostic software and its interfaces, which will help to save lives.
I'd like to first of all thank my girlfriend, Sandra Saenz Gonzalez, for her enormous support in taking on the project that this book was. I am greatly thankful for her constant understanding while having me closed up between four walls as I wrote and developed its contents. Thanks, Sandra, I love you.
Big thanks as well to my friend Jesus Salillas, who helped me with style reviews and guidance.
There are many good people out there who I have to thank, too. Thanks to Alfonso Rodriguez, who encouraged me to get into this "big .NET community world," and to Cristina Gonzalez, who has been my MVP Lead for—wow!—6 years already; easier said than done. Additionally, there is my good friend Paco Marin, who encouraged me strongly to write for him and his magazine, DotNetMania, now DNM, and during these years of collaboration, while writing for him, we have become good friends; thank you for all your support and care.
On the way, I found great friends out there, versed in the community, who allowed me to jump right at my passion. Thanks to the INETA guys, Damir Tomicic, Tomislav Bronzin, Sander Gerz, Andrej Radinjer, Andre Obelink, Christian Nagel, Dobrisa Adamec, and, of course, Miguel Lopez. Thank you for being there and doing what you do, greatly empowering the European developers' community. And for letting me take part in it and letting me "live it." One simple word—outstanding.
I'd like to give a big thank you to the staff of Packt Publishing for this opportunity, their support and patience on bringing this together, and for their understanding concerning my move to Switzerland, which had me a bit lost for a while (regarding the book). There you showcased that you are truly valuable, as a company and as people; special thanks to Rashmi Phadnis, Amey Sawant, and Dayan Hyames.
And finally I would like to thank Layla Driscoll, former Product Manager of the .NET CLR team, and Leon Welicki, Program Manager of the Workflow Foundation, both of whom I have had the honor of having as technical reviewers for this book. Thanks! It's awesome to count on you as reviewers.
I also have some friends who believed in me and encouraged me to write and said "I could do it"—thanks Braulio Diez, David Nudelman, Luis Franco, David Salgado, and Luis Fraile for your friendship, belief, and support.
I wouldn't have been able to write enclosed in the 15 square meters—my home for almost four months of my initial stay in Switzerland—if I couldn't take my stress out, which I did with my friends at Crossfit Zurich, so I want to give a big thank you to Ozi, all the coaches, and friends I have found at the "box" for being there!
And I will end by thanking those who started it all for me, that is, thanks to my father and mother for giving me birth and making me so curious; love you.
Thank you all!
Nauzad Kapadia is an independent professional and founder of Quartz Systems, and provides training and consulting services for the entire Microsoft .NET and SQL Server stack. Nauzad has over 17 years of industry experience and has been a regular speaker at events such as TechED, DevCon, DevDays, and user group events. He has been a Microsoft MVP (Most Valuable Professional) for six years on technologies ranging from C# and ASP.NET to SQL Server. Whenever he is not working on his computer, he enjoys rock music, photography, and reading.
Ariel Woscoboinik graduated as a Bachelor of Information Technology from the University of Buenos Aires, and as an IT technician from ORT school. Since his childhood he has been programing and getting more and more involved in the world of technology. Later on, he became interested in organizations and their business models and succeeded in converging both interests into his career—looking for the best solutions to involve people, processes, and technology.
Currently, he works as a Software Development Manager for Telefe, the leading TV channel in Argentina.
Ariel has been working with Microsoft technologies since high school. During his career, he has worked for highly prestigious companies from myriad industries—Microsoft, MAE, Intermex LLC, Pfizer, Monsanto, Banco Santander, IHSA, Disco S.A., Grupo Ecosistemas, Perception Group, and Conuar.
Among his passions are acting in dramas as an amateur actor, travelling around the world, watching films, and soccer.
You can reach him at http://www.linkedin.com/in/arielwoscoboinik or on twitter, @arielwos.
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
With about 10 years since its first release, Microsoft's .NET Framework 4.5 is one of the most solid development technologies for creating casual, business, or enterprise applications. It has evolved into a very stable and solid framework for developing applications, with a solid core called the CLR (Common Language Runtime). Microsoft .NET Framework 4.5 includes massive changes and enables modern application and UI development.
Microsoft .NET Framework 4.5 Quickstart Cookbook aims to give you a runthrough of the most exciting features of the latest version. You will experience all the flavors of .NET 4.5 hands on. The "How-to" recipes mix the right ingredients for a final taste of the most appetizing features and characteristics. The book is written in a way that enables you to dip in and out of the chapters.
The book is full of practical code examples that are designed to clearly exemplify the different features and their applications in real-world development. All the chapters and recipes are progressive and based on the fresh features of .NET Framework 4.5.
The book is divided into functional examples that combine many techniques to showcase the usage of a concrete .NET 4.5 feature.
Chapter 1, Windows Store Apps, shows us the basics, 101, of creating Windows Store apps and some key aspects of it, such as adding a splash screen, tiles, understanding the Windows 8 lifecycle model, and using toasts.
Chapter 2, Exploring the Top New Features of the CLR, helps us explore some of the most exciting features of the CLR, such as portable class libraries, controlling timeout on regular expressions, overriding the default reflection behavior, and understanding how to use async and await.
Chapter 3, Understanding the New Networking Capabilities, explores the new networking features and show us how to use the HttpClient and System.Net.Http namespaces.
Chapter 4, Understanding the New Features of Entity Framework 5.0, helps us explore Code First and Code First Migrations directly.
Chapter 5, Understanding the New Features of ASP.NET, helps us explore the new capabilities while creating an ASP.NET web forms application; it shows us how to use unobtrusive validation and explains what it is good for; and it focuses on the other improvements, such as smart tasks, WAI-ARIA support, and "extract to user control" between others.
Chapter 6, Implementing WPF New Features, covers the new way of handling errors in WPF asynchronously with INotifyDataErrorInfo, use the WeakEvent pattern with the WeakEventManager class, bind to static properties, Throttling data source update delays and LiveShapping, and repositioning elements in the view when its bound data gets updated.
Chapter 7, Applying the New WCF's Features, helps us explore some of the most interesting features of WCF, such as its asynchronous support, WebSockets, and Contract First development.
Chapter 8, Creating and Hosting Our First ASP.NET Web API, basically explores this amazing new feature under the ASP.NET umbrella: web API. We will be creating a basic web API, adding CRUD capabilities, and self-hosting it.
Chapter 9, Using the New Capabilities of WF, explores one of the most exciting updates for .NET 4.5; it comes, greatly polished, with a mature and greatly enhanced framework for the workflow foundation. Here we explore creating a state machine workflow and new designer capabilities.
Appendix A, Resources for Further Knowledge, provides key references to websites of interest regarding the areas covered in this book.
Appendix B, NET 4.5, Deployment Risks and Issues, will show us some issues that can happen when applying .NET 4.5 to an existing project and on its deployment, such as the limitation on platform, different behaviors of the .NET framework, and that some things that might work properly in our developer environment might not work as well when deployed.
For working through this book, .NET 4.5 is needed together with Visual Studio 2012; we recommend either the professional or a superior version. Regarding the operating system, Windows 8 is needed for some aspects as well, so it is the recommended operating system.
If you are a .NET developer and would like to learn the new features in .NET 4.5, this book is just for you. Prior experience with .NET Framework would be useful but not necessary.
Microsoft .NET Framework 4.5 Quickstart Cookbook gives architects and project managers a high-level overview and clear understanding of what the .NET 4.5 Framework provides and how it can be used.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
In this chapter, we will cover:
We are clearly speaking of a new, modern, and touch-friendly kind of application with the Windows Store apps style.
Windows Store app style application development, for the latest Windows 8 platform, is a very important part of this release of the .NET Framework 4.5.
We will explore Windows Runtime managed development in our development recipes. We also have the power of a very simple, well designed, and lightweight base class library API at our disposal (C# and VB) for developing Windows Store apps. This is called Windows Runtime, more commonly known as WinRT.
The following image clarifies the overall structure and components that we will have to use for developing Windows Store apps:
Portable libraries are there to help us port our existing code into multi-targeting scenarios such as Windows Store apps, Windows Phone, Silverlight, desktop, or X-box code with a strong focus on Model-View-ViewModel (MVVM). MVVM is an architectural design pattern designed for modern user interface (UI) development, very commonly used in XAML development. This will allow us to share the Model and ViewModel code with only the need for rewriting the UI and the application model, apart from the device integration.
Windows Store apps are designed for tablet devices and touch interaction, mainly for consumers. However, the good old desktop is still there and we can develop classic Windows applications, now called desktop apps, through the desktop mode.
Both of these execution and development modes coexist and are here for different scenarios. This chapter focuses on Windows Store apps development.
The Windows 8 app programming model basically:
WinRT provides projections that expose the API to the different development environments. With this we can use WinRT from the .NET Framework 4.5.
