4月26日
1.) Did you know that in Windows Vista you can launch all the shortcuts in you quick launch bar by clicking the “
Win” button + a
number (”WIN” + 1 will launch the first link from the left and so on…)?
2.) Create a shortcut to the application you want to run with the shortcut by right clicking the executable file and selecting “Create shortcut” from the menu.
Right click on the shortcut that was created, and select properties.
All you need to do is go over to the Shortcut key line and select your desired shortcut. For instance I have made the F1 and F2 function keys open Internet Explorer and Firefox respectively.
3.) If you need to configure more keyboard shortcuts check out GoHeer.com - Keyboard ShortCuts application
4月25日
What is LINQ to SQL? - implementation of the IQueryable interface over the SQL Server Schema
- generates queries directly against the schema objects (pretty much 1 to 1)
- queries returning objects (strongly typed experience over Sql Server Schema)
Visual LINQ Query Builder is an add-in to Visual Studio 2008 Designer that helps you visually build LINQ to SQL queries.
Functionally it provides the same experience as, for instance the Microsoft Access Query Builder, but in the LINQ domain.
The entire UI of this add-in uses Windows Presentation Foundation. The goal of this tool is to help users become more familiar with the LINQ syntax.
The tool may also demonstrate to users how to create their own Visual Studio 2008 add-in using Windows Presentation Foundation.
You can find this tool here and nice walk through of the tool on Mitsu's blog.

4月23日
Miscellaneous Tips/Tricks
Encapsulate Common Code (Ultimate Base Page Class http://tinyurl.com/2mjyud)
Avoid Storing Config Settings in <appSettings> - http://tinyurl.com/2lr6vw
- not strongly typed
- cluttered
- risk of collisions
Register Controls in web.config
- Custom Controls
<pages>
<controls>
<add tagPrefix="aspalliance" assembly="AspAlliance.Web.UI.Controls" />
</controls>
</pages>
- User Controls
<pages>
<controls>
<add tagPrefix="user" src="~/UserControls/LeftNav.ascx" />
</controls>
</pages>
Favor Hyperlinks over LinkButtons
Avoid Excessive use of Label
- label renders with span tags and has viewstate by default doubling bandwidth footprint
- use Literal or <%= Variable %> instead
Avoid Passing DataReaders
- open and close (and dispose) datareaders in the same method
- use using() and commandBehavior.CloseConnection
- if you must pass between methods use delegate pattern (http://aspalliance.com/526)
Visual Studio Tips
- Autocomplete variable names with ctrlspace
- Hold down ctrl to make the Intellisense
- window transparent so you can see your code
- Ctrl-K, Ctrl-D to reformat code
- Ctrl-. will add using statements
- Add shortcut to remove/sort using statements (Ctrl-Alt-O)
Tools/Products
ASP.NET 3.5 New Things
New Controls
- ListView (supports binding/editing/selecting/deleting/paging/sorting and complete control over html)
- DataPager (adds paging support to other controls (currently only ListView, customizable UI)
- LINQDataSource (Binds to any LINQ enabled data model)
- ASP.NET AJAX built in to VS.NET 2008
Visual Studio 2008 Enhancements
- multi-targeting support
- javascript intellisense
- javascript debugging
- AJAX Control Extender Support
- Web Designer and CSS Support
- Nested Master Page Support
- Vertical Split View (good for multi-monitor)
ASP.NET MVC (Model-View-Controller)
- Enables much better testability of web applications
- Provides complete control over output of web application
- Very few working controls, no viewstate
ADO.NET Data Services
Easily makes data easily available to other clients via http
.NET & Silverlight Client Libraries
- Microsoft.Data.WebClient namespace (WebDataContext, WebDataQuery)
- Query with LINQ or Object Services
- All CRUD operations available
LINQ the defining feature in .NET 3.5
- LINQ is an expression parser (implemented via Extension Methods) i.e. Select(), .Where(), .GroupBy()
- Core LINQ Language Features
- Anonymous Types (dynamic type creation)
- Type Inference (var)
- Object Initializers (default value assignments)
- Extension Methods (extend existing classes with new methods)
- Lambda Expressions (simplified predicate or expression syntax)
LINQ to SQL (Database to Entity Mapping)
- maps database schema to object schema
- simplified 1 - 1 mapping (tables -> entities)
- LINQ to SQL Designer allows customization
LINQ over Entity Model
LINQ TO SQL is not Business Layer - one of the challenges of LINQ is to establish appropriate business layer approach. No place to hook up business logic in model. No multi-tier logic abstraction. Essentially two-tier if used in UI directly. There are some techniques to establish or wrap LINQ to establish business layer behavior.
ASP.NET Custom Controls with AJAX
AJAX Control Options
- Build a control from scratch (ultimate in flexibility but can be time consuming)
- use ASP.NET AJAX Extensions classes as a foundation (require custom mapping of server side and client side properties)
- use the ASP.NET AJAX Toolkit control framework (simplifies control development but requires AjaxControlToolkit.dll assembly)
AJAX Extensions Steps
- define/register control namespace
- create control with constructor and private properties
- create control properties with prototype design pattern
- dispose of resources
- register type with ASP.NET AJAX Script Library
AJAX Toolkit Extension Control
- Reference AjaxControlToolkit.dll
- Create server control and derive from ExtenderControlBase
- Reference embedded script control using WebResource and ClientScriptResource attributes
- Map properties using ExtenderControlProperty
4月22日
CLR in SQL Server 2005
CLR Option (disabled by default, once enabled it is hard to turn off)
CLR Code can be used in…
- Stored procedures, Triggers, Functions, Aggregates, UDTs, Reports
But Should it? - consider performance, security and development issues
Extended Stored procedures (SQL 2000) are excellent candidates for application of CLR Technology.
Where Does CLR Technology Fit?
- To replace existing Extended Stored Procedures
- For complex mathematical formulas
- For access to .NET Framework functionality (i.e. encryption)
- As an interface to non-standard data sources
- CLR-based User-defined types
- Permit smarter, more complex data types
Challenges
- No control over 'safety' of code created (all or nothing)
- Database Dependencies - once a udt is used, dependencies must be removed before it can be changed
- Visual Studio support - more complex development to integrate
CLR Assemblies designate security level
- SAFE (the default)
- No external system resource access (code not trusted)
- VS.NET 2005 assumes permission Level = Safe (anything but safe means the CLR can blue screen SQL Server server.
- EXTERNAL_ACCESS
- Permitted to access specific external resources (code has provisional trust)
- UNSAFE
- Permitted to access anything (code fully trusted)
Development of more complex CLR assemblies requires build scripts to tear down dependencies and recreation.
Comparisons of performance must be done through SQL Enterprise Manager (as opposed to VS.NET). VS.NET adds a lot of overhead to performance information and thereby skewing the end results.
User Defined Types (defined with VS.NET in managed language)
- Serialization - taking properties of UDT and save out as bits into backing store (serialization provided by VS.NET only is functional with fixed length data types)
- De-Serialization - taking bits and populating properties of UDT
A common design pattern for data modeling is to divide the data model into three components
- Conceptual Model - defines the entities and relationships in the system being modeled
- Logical Model - normalizes the entities and relationships into relational database tables with foreign key constraints
- Physical Model - specifies engine-specific storage details such as partitioning and indexing
The ADO.NET Entity Framework expands the power of the conceptual model by enabling developers to write code that operates against objects generated from an Entity Data Model (EDM) instead of directly against the logical (relational) model. The Entity Framework then maps those operations to storage-specific relational commands.
Benefits
- developers can develop against a model independent on underlying storage mechanics
- mappings between the model and physical structure can be performed without changing code
- multiple models can exist for a single storage schema
- model has features such as strong typing with type hierarchies, navigable relationships, and complex types.
Getting Started with Entity Model
Key Aspects
- Conceptual mapping - logical layers
- Entity Data Model (EDM)
- Entity Client
- ADO.NET data provider that exposes data in terms of a conceptual Entity Data Model, queried through a common Entity SQL language
- Entity SQL
- SQL based query language extended to express queries in terms of EDM
- Object Services
- Providing services such as state management, change tracking, identity resolution, loading and navigating relationships, propagation of object changes to database modifications, and query building support for Entity SQL
- LINQ for Entities
- Allows you to write LINQ queries through Entity Client to return data
Entity Framework Compared to LINQ to SQL
- LINQ is rapid development
- Direct 1:1 mapping of classes and schema
- Can override CRUD methods
- SQL Server DB
Entity Framework Highlights
- Write less data access code
- Reduce maintenance (maintenance is done through UI with EM)
- Abstracts structures into Object Oriented model
Querying the Entity Framework
- Entity Client with Entity SQL
- Flexible string based syntax (good for getting back data based on dynamic requests (i.e. search page))
- Ado.net data provider
- No entities
- Object Services with Entity SQL (more dynamic)
- Flexible string based syntax
- Can return objects
- LINQ to Entities (more dynamic)
- Strongly typed syntax
- Can return objects
Editorial: This technology is the one that has been missing from Microsoft in the last x years. In lieu of this framework there have been a number of other technologies (i.e. NHiberate, Subsonic, CSLA.net etc.). In short this is Microsoft's Enterprise level object relational/mapping product. It is currently in beta but is to be released this summer. In short EF provides wizards that aid in the mapping of database tables (currently only SQL Server but other vendors Oracle/MySQL are already building providers to hook up) and maps them to database objects. It differs from LINQ to SQL in the fact that it builds a model that is now available for additional manipulation such as merging tables, filtering tables and creating additional tables build from query/view or stored procedure.
Modifications to the underlying database require updates to the model but with custom code in partial classes this can be done with very little effort.
Currently, only the primary entity is serialized through WCF but in the following release child objects will be serialized through WCF without any data loss. At the current time, this can be managed through passing the primary object in list object with child objects in related list object. This can be accomplished with wrapper for transmission of the entity through serialization process.
4月21日
I have the good fortune to attend the Orlando DevConnections 2008. This is a Web/Winform/Sharepoint/Sql conference with attendance > 3000 developers. The conference started Saturday for some that chose to attend pre-conference sessions. I flew in Sunday evening early enough to catch part of the 8pm keynote talk. The keynote covered at a high level features of both Sharepoint and Studio 2008. Thomas Rizzo and Norman Guadagno. The content was light and really just intended as a kick off for the days to come.
Keynote Monday morning started with a very good review of new Microsoft products by the always entertaining Scott Guthrie.
- IIS7 Coverage
- Delivered with Windows 2008
- Microsoft.com (4th in world based on hits) is running 3.5 with IIS7 Windows 2008
- Dell.com (2nd in world based on hits) is running 3.5 IIS7 Windows 2008
- Silverlight 2.0 Beta 1 w/Expression Blend and Studio
- 38 controls available now (100 by end of the year provided by Microsoft)
- Expression Blend and Visual Studio seamless integration for editing of asp.net and Silverlight applications
- Silverlight live example http://memorabilia.hardrock.com
Dynamic Data Controls Model View Controller - Enables easier TDD development
- Enables more control HTML
- Separation of layers which allows better testing of each layer in isolation
- Currently a Beta product that may fit your development needs but it was clear that this is the type of technology that may or may not fit your requirements (motorcycles and cars)
Linq / Entity Model - Linq to XML (some really nice features as an alternative to XPath and DOM access to XML documents)
- Linq to Entity Model
- Linq to Datasets
- Linq to SQL
Sharepoint (the next version will be 64bit only) Of all the technologies - Silverlight was the single most important language/platform that is going to have influence on all developers.
What's New in IIS7
- Most of the configuration(s) that can be done through the administrative tools can be setup within the web.config of the application
- IIS7 provides both classic and integrated modes
- Classic utilized with asp and .net 1.1, 2.0 without any migration
- Integrated mode establishes the web stream and respective objects as first class objects in .net
- command line migration utility available for 2.0 applications
- ability to define handlers/modules all within web.config
- ability to include non-aspx files in authentication schemes
- output caching feature now available through IIS (admin tool) as well as with web.config
- soon to be released ability to synchronize IIS7 configurations across multiple web servers
- ability to point via unc IIS configuration to a shared file on the network (ensure that multiple servers are setup consistently)
- iis7 in vista is the same as provided with Windows 2008
Ability to remotely configure IIS7 services Ability to manage .NET users/roles that is involved with provided Membership system through IIS Silverlight and Cross Platform Development (Scott Guthrie)
- Scott covered overview of basic components of Silverlight include lines, shapes, panels, textboxes as well as panels, brushes and transforms etc.
- Demonstrated the ability to create user control with Blend (re-use), databinding (2-way), open file dialog box
- Ability to store styles and behaviors separately from code (for re-application) across projects
- 1000 faster than JavaScript
- Networking support
- Local caching ability up to 1mb (with granted privileges can be higher)
- SMS policy can automatically install Silverlight across company
- Blend next version with have source control integration (currently, you must check out via vs.net then edit with Blend)
Model View Controller Pattern (Scott Guthrie)
- typical pattern {controller}/{action}/{id} i.e. /Home, /Home/Index, /Home/Add?x=5&y=7 (querystring values map to method parameters)
- int? (new nullable types)
- demos, demos, and demos
Linq / Entity Model / Datasets (What's all this about)
- Linq
- Linq to XML (some really nice features as an alternative to XPath and DOM access to XML documents)
- Linq to Entity Model
- Linq to Datasets
- Linq to SQL
Entity Model ADO.NET and Data Services Exhibit Hall (Vendors of interest)
- CorasWorks - Sharepoint collaboration and data-mining product
- Telerk - new releases of their Asp.net Component Suite 2008 Q1
More to come on Tuesday...