+ All Categories
Home > Technology > Intro to .NET for Government Developers

Intro to .NET for Government Developers

Date post: 18-Nov-2014
Category:
Upload: frank-la-vigne
View: 1,328 times
Download: 1 times
Share this document with a friend
Description:
Presention I gave at the 2012 SC GMIS Developer Summit. Covers a wide range of .NET Developer Topics.
Popular Tags:
69
Developing with .NET Frank La Vigne Developer Evangelist Microsoft @tableteer | [email protected] www.FranksWorld.com/blog
Transcript
Page 1: Intro to .NET for Government Developers

Developing with .NET

Frank La Vigne

Developer Evangelist

Microsoft

@tableteer | [email protected]/blog

Page 2: Intro to .NET for Government Developers

A Quick Word About MSDN

Not just downloads• Documentation• Articles• Sample Code• Specialty sites• ASP.NET• Silverlight.net• WindowsClient.net

• And much more!

Page 3: Intro to .NET for Government Developers

The Future

Page 4: Intro to .NET for Government Developers

Soon, Very Soon.

Page 5: Intro to .NET for Government Developers

Tools of the Trade

• Visual Studio 2010• Multiple versions with multiple price points

• Expression Blend

Nice to have tools• F12 Dev Tools• Fiddler• Silverlight Spy

Page 6: Intro to .NET for Government Developers
Page 7: Intro to .NET for Government Developers

.NET Everywhere

Web Windows Cloud Phone Games Data

Write .NET Code in All of These Environments

Page 8: Intro to .NET for Government Developers

.NET Architecture

.NET Framework Architecture

Base Class Libraries

Common Language RuntimeJIT & NGEN

Garbage Collector

Security Model

Exception Handling

Loader & Binder

WPFWin

FormsDLR ASP.NET WCF

And more!

LINQ

Page 9: Intro to .NET for Government Developers

BASE CLASS LIBRARIES(BCL) IMPROVEMENTS IN .NET 4.X

Page 10: Intro to .NET for Government Developers

Task Parallel Library (TPL)

Set of public types and APIs System.Threading System.Threading.Tasks

// Sequentialforeach (var item in sourceCollection) { Process(item); }

// ParallelParallel.ForEach (sourceCollection, item => Process(item));

Page 11: Intro to .NET for Government Developers

Parallel LINQ (PLINQ)

Implements the full set of LINQ standard query operators Extension methods for the IParallelEnumerable interface Additional operators for parallel operations

from n in names.AsParallel().WithDegreeOfParallelism(ProcessorsToUse.Value)where

n.Name.Equals(queryInfo.Name, StringComparison.InvariantCultureIgnoreCase) &&

n.State == queryInfo.State && n.Year >= yearStart && n.Year <= yearEnd

orderby n.Year ascending

select n;

Page 12: Intro to .NET for Government Developers

Design By Contract

• System.Diagnostics.Contracts• Code Contracts introduce a way to specify contractual

information that is not represented by a method or type’s signature alone

• Scenarios for using contracts include:• Perform static bug finding, which enables some bugs to be found

without executing the code• Create guidance for automated testing tools to enhance test

coverage• Create a standard notation for code behavior, which provides

more information for documentation

Page 13: Intro to .NET for Government Developers

Data Types

• BigInteger• Immutable type that represents an arbitrarily large integer whose

value in theory has no upper or lower bounds

• SortedSet<T>• Provides a self-balancing tree that maintains data in sorted order

after insertions, deletions, and searches

Page 14: Intro to .NET for Government Developers

I/O

• Memory-Mapped File• Used to edit very large files and to create shared memory

for inter-process communication

• Stream.CopyTo• Allows you to copy the contents of one stream into another

Page 15: Intro to .NET for Government Developers

EHANCEMENTS TO PROGRAMMING LANGUAGESIN .NET 4.X

Page 16: Intro to .NET for Government Developers

Visual Basic

• Auto-Implemented Properties• Shortened syntax that enables you to quickly specify a property

of a class without having to write code

• Collection Initializer• Shortened syntax that enables you to create a collection and

populate it with an initial set of values

• Implicit Line Continuation• Enables you to continue a statement on the next consecutive line

without using the underscore character

Page 17: Intro to .NET for Government Developers

C#

• Dynamic Type• Operations that contain expressions of type dynamic are not

resolved or type ch`ecked by the compiler. The compiler packages together information about the operation, and that information is later used to evaluate the operation at run time

• Optional and Named Parameters• Named arguments enable you to specify an argument for a

particular parameter by associating the argument with the parameter's name rather than with the parameter's position in the parameter list.

• Optional arguments enable you to omit arguments for some parameters. Both techniques can be used with methods, indexers, constructors, and delegates.

Page 18: Intro to .NET for Government Developers

C++

• You can configure restart manager to autosave documents and restart your application after it exits unexpectedly

• Lambda expressions are available in C++• The new CTaskDialog replaces the standard Windows

message box and adds functionality to display and gather more information

Page 19: Intro to .NET for Government Developers

F#

• IDE support for F#• Interactive F# for prototyping code• Asynchronous constructs• Parallel constructs• Immutable data types

Page 20: Intro to .NET for Government Developers

Web Client Development

Page 21: Intro to .NET for Government Developers

But What About?

Page 22: Intro to .NET for Government Developers

I <3 Silverlight!

Page 23: Intro to .NET for Government Developers

You Can Use Them Both

• Blue Angels Web Site• http://blueangels.navy.mil

Page 24: Intro to .NET for Government Developers

Looking Forward

Page 26: Intro to .NET for Government Developers

The Microsoft Web Platform

Web

Pla

tfor

m I

nsta

ller Ajax Control Toolkit & jQuery

ASP.NET

ADO.NET Entity Framework

SQL Server

IIS

The Microsoft Web Platform combines a rich and powerful web application framework with a supporting cast of tools, servers, technologies and applications for creating, designing, developing and delivering web solutions.

Page 27: Intro to .NET for Government Developers

Today’s Web Developers

I <3 Web Apps.

I just need a tool that

makes them easier to

configure, customize and

publish them

I want to build web sites myself with an

easy to learn tool and framework

I’m a professional software developer and I build complex, large scale web sites with a

team of developers

Page 28: Intro to .NET for Government Developers

A Free Web Dev Tool

Page 29: Intro to .NET for Government Developers

ASP.NET: A Framework For All

Caching Modules

HandlersIntrinsics

Pages Controls

Globalization

Profile

Master Pages

MembershipRoles

Etc.

ASP.NET Core

ASP.NET Web Forms

ASP.NET MVC

ASP.NET Web Pages

Web Forms View Engine Razor View Engine

Visual Studio 2010 WebMatrix

Page 30: Intro to .NET for Government Developers

ASP.NET 4 Webforms

• Ability to set meta tags• More control over view state• Added and Updated browser definition files• ASP.NET Routing• The ability to persist selected rows in data controls• More control over rendered HTML in the FormView and

ListView controls• Filtering support for data source controls

Page 31: Intro to .NET for Government Developers

CHOICE IS GOOD

Page 32: Intro to .NET for Government Developers

WHAT IS MVC?

Page 33: Intro to .NET for Government Developers

Model-View-Controller (MVC)

• Huge investment from Microsoft• Alternative to WebForms• Modular Architecture• MVC 3.0 now available• MVC 4 in Developer Preview stage

• Razor Syntax• MVC 3.0 Tooling Updated

April 2011

Page 34: Intro to .NET for Government Developers

ASP.NET MVC 101

Model(Data)

View(Presentation)

Controller(Input)

Page 35: Intro to .NET for Government Developers

• What does MVC look like?

How MVC Works

Request

View

Controller

Response

ControllerRetrieves Model“Performs Work”

ViewVisually representsthe model

Page 36: Intro to .NET for Government Developers

WHY SHOULD WE CARE ABOUT ASP.NET MVC IN PUBLIC SECTOR?

Page 37: Intro to .NET for Government Developers

More Web Savvy Citizens

• Users disdain “Ugly” URLs• http://answers.usa.gov/system/selfservice.controller?

CONFIGURATION=1000&PARTITION_ID=1&CMD=VIEW_ARTICLE&ARTICLE_ID=11951&USERTYPE=1&LANGUAGE=en&COUNTRY=USvshttp://www.whitehouse.gov/briefing-room/speeches-and-remarks

• Search Engine Optimization (SEO)• Discoverability

Page 38: Intro to .NET for Government Developers

Developer Productivity

• Powerful, patterns-based way to build dynamic websites • Enables a clean separation of concerns• Gives you full control over markup for enjoyable, agile

development.

Page 39: Intro to .NET for Government Developers

Testing

• Enable fast, TDD-friendly development for creating sophisticated applications

• Separation of concerns makes for easier testing

Page 40: Intro to .NET for Government Developers

Accessibility

• Uses the latest web standards.• Full control over markup makes creating

compliant sites easier

Page 41: Intro to .NET for Government Developers

Performance

• No ViewState • Smaller HTML payload• Faster downloads

• HTML5• Easy to implement eye catching graphics that leverage GPU

acceleration with IE9 and IE10

Page 42: Intro to .NET for Government Developers

DEMOCreating an ASP.NET MVC 3 Project

Page 43: Intro to .NET for Government Developers

Razor

Page 44: Intro to .NET for Government Developers

@if (You.Understand(Razor)) {

<div>Hooray!</div>

}• New, Simplified View Engine• Write fewer lines of code• More natural mix code and markup• Helpers save you time• Compatible with ASP.NET Web Pages in WebMatrix• http://bit.ly/WhatIsWebMatrix

Razor Syntax

Page 45: Intro to .NET for Government Developers

Razor: a Cut Above the Rest

<ul> <% for (int i = 0; i < 10; i++) { %> <li><% =i %></li> <% } %></ul>

<ul> @for (int i = 0; i < 10; i++) { <li>@i</li> }</ul>

Razor (2 markup transitions):

Web Forms (6 markup transitions):

<ul> <?php for ($i = 0; $i < 10; $i++) { echo("<li>$i</li>"); } ?></ul>

PHP(2 markup transitions

& an echo):

Page 46: Intro to .NET for Government Developers

Easier Code to Markup Transitions

@{ var name = “John Doe”; <div> Your name: @name </div>}

@{ var name = “John Doe”; @: Your name: @name}

Option 3:Single line of output

in markup

Option 1:HTML Block

@{ var name = “John Doe”; <text> Your name: @name </text>}

Option 2:Text Block

Page 47: Intro to .NET for Government Developers

Code Comments in Razor

@* <div> Hello World </div>*@

@* @{ var name = "John Doe"; @name }*@

Option 3:Both

Option 1:Markup

@{ //var name = "John Doe”; //@name}

Option 2:Code

Page 48: Intro to .NET for Government Developers

SILVERLIGHT & WPF DEVELOPMENT

Page 49: Intro to .NET for Government Developers

Two Platforms

Page 50: Intro to .NET for Government Developers

Similar But Different

WPF

Silverlight

Page 51: Intro to .NET for Government Developers

2 Platforms Powered By XAML

Two Core Technologies

One Common Language

XAML Powers It All

Page 52: Intro to .NET for Government Developers

Intro to XAML

• Markup language derived from XML• XML serialization of CLR objects• Markup files have code-behind files• Could be C# or VB.NET

• Conceptually similar to ASP.NET • X stands for Extensible• Data Binding• Styles• Templates

Relax, it’s just XML.

Page 53: Intro to .NET for Government Developers

What Does XAML Look Like?

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Grid>

<Button>Click Me!</Button> </Grid></Window>

Page 54: Intro to .NET for Government Developers

Results

Page 55: Intro to .NET for Government Developers

Most Devs Reaction to Blend

Page 56: Intro to .NET for Government Developers

Demo

Page 57: Intro to .NET for Government Developers

Mobile

Page 58: Intro to .NET for Government Developers

1 Platform. 2 Choices.

For the purposes of this talk, we’ll focus on Silverlight.

Page 59: Intro to .NET for Government Developers

What is Metro?

Page 60: Intro to .NET for Government Developers
Page 61: Intro to .NET for Government Developers

ETRO

METRO IS OUR DESIGN LANGUAGE. WE CALL IT METRO BECAUSE IT’S MODERN AND CLEAN. IT’S FAST AND IN MOTION. IT’S ABOUT CONTENT AND TYPOGRAPHY. AND IT’S ENTIRELY AUTHENTIC.

Page 62: Intro to .NET for Government Developers

Desktop?

Page 63: Intro to .NET for Government Developers

Metro Resources

• http://frnk.us/8GreatTraitsOfMetroApps• http://frnk.us/MetroTutorial

Page 64: Intro to .NET for Government Developers

DEMOCreating a Windows Phone App

Page 65: Intro to .NET for Government Developers

Marketplace Sample

Page 66: Intro to .NET for Government Developers

What is the Entity Framework?

• Creates Entity Model from Database• Helpful in creating RESTful Services• Exposes Database as Classes/Methods• Works with any Database• Useful in MVC, Dynamic Data Models

Page 67: Intro to .NET for Government Developers

Code-First in EF 4.1

ExistingDatabase

GeneratedEntity Data

Model

DatabaseFirst

Entity DataModel

GeneratedDatabase

ModelFirst

Page 68: Intro to .NET for Government Developers

DEMO

Page 69: Intro to .NET for Government Developers

Useful Resources

Phone SDK Download

http://bit.ly/WinPhoneSDKDownload Web Matrix

http://bit.ly/WhatIsWebMatrix Azure

http://bit.ly/FreeAzure90DayTrial

http://bit.ly/DownloadAzureSDK


Recommended