Wednesday, January 16, 2008

Architecture of LINQ

LINQ consists of three major components:

*LINQ to Objects
*LINQ to ADO.NET, which includes
*LINQ to SQL (formerly called DLinq)
*LINQ to DataSet (formerly called LINQ over DataSet)
*LINQ to Entities
*LINQ to XML (formerly called XLinq)

The folloing figure depicts the LINQ architecture which clearly shows the various components of LINQ and their related data stores.



LINQ to Objects deals with in-memory data. Any class that implements the IEnumerable interface (in the System.Collections.Generic namespace) can be queried with Standard Query Operators.

LINQ to ADO.NET (also known as LINQ enabled ADO .NET) deals data from external sources, basically anything ADO.NET can connect to. Any class that implements IEnumerableor IQueryable (in the System.Query namespace) can be queried with Standard Query Operators. The LINQ to ADO.NET functionality could be achieved by using System.Data.Linq namespace.

LINQ to XML is a comprehensive API for in-memory XML programming. Like the rest of LINQ, it includes Standard Query Operators, and it can also be used in concert with LINQ to ADO.NET, but its primary purpose is to unify and simplify the kinds of things that disparate XML tools, like XQuery, XPath and XSLT are typically used to do. The LINQ to XML functionality could be achieved by using System.Xml.Linq namespace.

Monday, January 14, 2008

The book I authored - C# 2008 Databases

I have just got my C# 2008 Databases book which I have been authoring for Apress Inc. USA got released on 14-Jan-2008. Here are the details which may interest you. This book mainly covers SQL Server 2005 new T-SQL features,Visual Studio 2008, LINQ, ADO.NET 3.5 besides all other concepts you need to know. Do have look at the Table of Contents below.

To purchase this book please follow your desired links you would like to purchase it from Apress Inc or Amazon

I believe that this book will become availabe in INDIA by the later half of this year 2008.So if you don't want to purcase it online and would like to have it in INDIA, then please feel free to contact me at my e-mail Vidya_mct@yahoo.com



Who This Book Is For
If you are an application developer who likes to interact with databases using C# this book is for you, as it covers programming SQL Server 2005 using C# 2008. This book does not require or even assume that you have sound knowledge of C# 2.0 and SQL Server 2000 and database concepts. We have covered all the fundamentals that other books assume a reader must have before moving on with the chapters. This book is a must for any application developer who intends to interact with databases using C# 2008 as the development tool; if this is you, then this book is a must.

What This Book Covers
This book covers Visual Studio 2008, SQL Server 2005, C# 2008, LINQ, and ADO.NET 3.5. All these topics are covered in the form of chapters that explain these tools and technologies using various concepts and code examples. We also modeled the applications used in this book on real-life applications, so you can utilize the concepts that you will learn throughout this book in your professional life.

How This Book Is Organized
This book is organized in such a way that concepts in each chapter are built upon in subsequent chapters. We also tried to make chapters self-contained, so the reader can concentrate on the chapter at hand rather than switching focus among the hapters to understand the concepts. The concepts explained in each chapter are demonstrated with code examples in the “Try It Out” sections, which are usually followed by “How It Works” sections that will help you understand each code statement and its purpose.

Table of Contents

CHAPTER 1 Getting Your Tools
Obtaining Visual Studio 2008
Installing SQL Server Management Studio Express
Installing the Northwind Sample Database
Installing the Northwind Creation Script
Creating the Northwind Sample Database
Installing the AdventureWorks Sample Database
Installing the AdventureWorks Creation Script
Creating the AdventureWorks Sample Database
Summary

CHAPTER 2 Getting to Know Your Tools
Microsoft .NET Framework Versions and the Green Bit and
Red Bit Assembly Model
Using Microsoft Visual Studio 2008
Try It Out: Creating a Simple Console Application Project
Using Visual Studio 2008
How It Works
Using SQL Server Management Studio Express
Summary

CHAPTER 3 Getting to Know Relational Databases
What Is a Database?
Choosing Between a Spreadsheet and a Database
Why Use a Database?
Benefits of Using a Relational Database Management System
Comparing Desktop and Server RDBMS Systems
Desktop Databases
Server Databases
The Database Life Cycle
Mapping Cardinalities
Understanding Keys
Primary Keys
Foreign Keys
Understanding Data Integrity
Entity Integrity
Referential Integrity
Normalization Concepts
Drawbacks of Normalization
Summary

CHAPTER 4 Writing Database Queries
Comparing QBE and SQL
Beginning with Queries
Try It Out: Running a Simple Query
How It Works
Common Table Expressions
Try It Out: Creating a CTE
How It Works
GROUP BY Clause
Try It Out: Using the GROUP BY Clause
How It Works
PIVOT Operator
Try It Out: Using the PIVOT Operator
How It Works
ROW_NUMBER() Function
Try It Out: Using the ROW_NUMBER() Function
How It Works
PARTITION BY Clause
Try It Out: Using the PARTITION BY Clause
How It Works
Pattern Matching
Try It Out: Using the % Character
How It Works
Try It Out: Using the _ (Underscore) Character
How It Works
Try It Out: Using the [ ] (Square Bracket) Characters
How It Works
Try It Out: Using the [^] (Square Bracket and Caret)
Characters
How It Works
Aggregate Functions
Try It Out: Using the MIN, MAX, SUM, and AVG Functions
How It Works
Try It Out: Using the COUNT Function
How It Works
DATETIME Functions.
Try It Out: Using T-SQL Date and Time Functions
How It Works
Joins
Inner Joins
Outer Joins
Other Joins
Summary

CHAPTER 5 Manipulating Database Data
Retrieving Data
Try It Out: Running a Simple Query
How It Works
Using the WHERE Clause
Sorting Data
Using SELECT INTO Statements
Try It Out: Creating a New Table
How It Works
Try It Out: Using SELECT INTO to Copy Table Structure
How It Works
Inserting Data
Try It Out: Inserting a New Row
How It Works
Updating Data
Try It Out: Updating a Row
How It Works
Deleting Data
Summary

CHAPTER 6 Using Stored Procedures
Creating Stored Procedures
Try It Out: Working with a Stored Procedure in SQL Server
How It Works
Try It Out: Creating a Stored Procedure with an
Input Parameter
How It Works
Try It Out: Creating a Stored Procedure with an
Output Parameter
How It Works
Modifying Stored Procedures
Try It Out: Modifying the Stored Procedure
How It Works
Displaying Definitions of Stored Procedures
Try It Out: Viewing the Definition of Your Stored Procedure
How It Works
Renaming Stored Procedures
Try It Out: Renaming a Stored Procedure
How It Works
Working with Stored Procedures in C#
Try It Out: Executing a Stored Procedure with
No Input Parameters
How It Works
Try It Out: Executing a Stored Procedure with Parameters
How It Works
Deleting Stored Procedures
Try It Out: Deleting a Stored Procedure
How It Works
Summary

CHAPTER 7 Using XML
Defining XML
Why XML?.
Benefits of Storing Data As XML
Understanding XML Documents
Understanding the XML Declaration
Converting Relational Data to XML
Using FOR XML RAW
Using FOR XML AUTO
Using the xml Data Type
Try It Out: Creating a Table to Store XML
How It Works
Try It Out: Storing and Retrieving XML Documents
How It Works
Summary

CHAPTER 8 Understanding Transactions
What Is a Transaction?
When to Use Transactions
Understanding ACID Properties
Transaction Design
Transaction State
Specifying Transaction Boundaries
T-SQL Statements Allowed in a Transaction
Local Transactions in SQL Server 2005
Distributed Transactions in SQL Server 2005
Guidelines to Code Efficient Transactions
How to Code Transactions
Coding Transactions in T-SQL
Coding Transactions in ADO.NET
Summary

CHAPTER 9 Getting to Know ADO.NET
Understanding ADO.NET
The Motivation Behind ADO.NET
Moving from ADO to ADO.NET
ADO.NET Isn’t a New Version of ADO
ADO.NET and the .NET Base Class Library
Understanding ADO.NET Architecture
Working with the SQL Server Data Provider
Try It Out: Creating a Simple Console Application
Using the SQL Server Data Provider
How It Works
Working with the OLE DB Data Provider
Try It Out: Creating a Simple Console Application
Using the OLE DB Data Provider
How It Works
Working with the ODBC Data Provider
Creating an ODBC Data Source
Try It Out: Creating a Simple Console Application
Using the ODBC Data Provider
How It Works
Data Providers Are APIs
Summary

CHAPTER 10 Making Connections
Introducing the Data Provider Connection Classes
Connecting to SQL Server Express with SqlConnection
Try It Out: Using SqlConnection
How It Works
Debugging Connections to SQL Server
Security and Passwords in SqlConnection
How to Use SQL Server Security
Connection String Parameters for SqlConnection
Connection Pooling
Improving Your Use of Connection Objects
Using the Connection String in the Connection Constructor
Displaying Connection Information
Connecting to SQL Server Express with OleDbConnection
Try It Out: Connecting to SQL Server Express with the
OLE DB Data Provider
How It Works
Summary

CHAPTER 11 Executing Commands
Creating a Command
Try It Out: Creating a Command with a Constructor
How It Works
Associating a Command with a Connection
Assigning Text to a Command
Executing Commands
Try It Out: Using the ExecuteScalar Method
How It Works
Executing Commands with Multiple Results
Try It Out: Using the ExecuteReader Method
How It Works
Executing Statements
Try It Out: Using the ExecuteNonQuery Method
How It Works
Command Parameters
Try It Out: Using Command Parameters
How It Works
Summary

CHAPTER 12 Using Data Readers
Understanding Data Readers in General
Try It Out: Looping Through a Result Set
How It Works
Using Ordinal Indexers
Using Column Name Indexers
Using Typed Accessor Methods
Getting Data About Data
Try It Out: Getting Information About a Result Set with a
Data Reader
How It Works
Getting Data About Tables
Try It Out: Getting Schema Information
How It Works
Using Multiple Result Sets with a Data Reader
Try It Out: Handling Multiple Result Sets
How It Works
Summary

CHAPTER 13 Using Datasets and Data Adapters
Understanding the Object Model
Datasets vs. Data Readers
A Brief Introduction to Datasets
A Brief Introduction to Data Adapters
A Brief Introduction to Data Tables, Data Columns,
and Data Rows
Working with Datasets and Data Adapters
Try It Out: Populating a Dataset with a Data Adapter
How It Works
Filtering and Sorting in a Dataset
Comparing FilterSort to PopDataSet
Using Data Views
Modifying Data in a Dataset
Propagating Changes to a Data Source
UpdateCommand Property
InsertCommand Property
DeleteCommand Property
Command Builders
Concurrency
Using Datasets and XML
Try It Out: Extracting a Dataset to an XML File
How It Works
Using Data Tables Without Datasets
Try It Out: Populating a Data Table with a Data Adapter
How It Works
Understanding Typed and Untyped Datasets
Summary

CHAPTER 14 Building Windows Forms Applications
Understanding Windows Forms
User Interface Design Principles
Best Practices for User Interface Design
Simplicity
Position of Controls
Consistency
Aesthetics
Color
Fonts
Images and Icons
Working with Windows Forms
Understanding the Design and Code Views
Sorting Properties in the Properties Window
Categorized View
Alphabetical View
Setting Properties of Solutions, Projects, and Windows Forms
Working with Controls
Try It Out: Working with the TextBox and Button Controls
How It Works
Setting Dock and Anchor Properties
Dock Property.
Anchor Property .
Try It Out: Working with the Dock and Anchor Properties
How It Works
Adding a New Form to the Project
Try It Out: Adding a New Form to the Windows Project
Try It Out: Setting the Startup Form
How It Works
Implementing an MDI Form
Try It Out: Creating an MDI Parent Form with a Menu Bar
Try It Out: Creating an MDI Child Form and Running an
MDI Application
How It Works
Summary

CHAPTER 15 Building ASP.NET Applications
Understanding Web Functionality
The Web Server
The Web Browser and HTTP
Introduction to ASP.NET and Web Pages
Understanding the Visual Studio 2008 Web Site Types
File System Web Site
FTP Web Site
HTTP Web Site
Layout of an ASP.NET Web Site
Web Pages
Application Folders
The web.config File
Try It Out: Working with a Web Form
Try It Out: Working with Split View
Using Master Pages
Try It Out: Working with a Master Page
Summary

CHAPTER 16 Handling Exceptions
Handling ADO.NET Exceptions
Try It Out: Handling an ADO.NET Exception (Part 1)
How It Works
Try It Out: Handling an ADO.NET Exception (Part 2)
How It Works
Handling Database Exceptions
Try It Out: Handling a Database Exception (Part 1):
RAISERROR
How It Works
Try It Out: Handling a Database Exception (Part 2):
Stored Procedure Error
How It Works
Try It Out: Handling a Database Exception (Part 3):
Errors Collection
How It Works
Summary

CHAPTER 17 Working with Events
Understanding Events
Properties of Events
Design of Events
Common Events Raised by Controls
Event Generator and Consumer
Try It Out: Creating an Event Handler
How It Works
Try It Out: Working with Mouse Movement Events
How It Works
Try It Out:Working with the Keyboard’s KeyDown and
KeyUp Events
How It Works
Try It Out: Working with the Keyboard’s KeyPress Event
How It Works
Summary

CHAPTER 18 Working with Text and Binary Data
Understanding SQL Server Text and Binary Data Types
Storing Images in a Database
Try It Out: Loading Image Binary Data from Files
How It Works
Rerunning the Program
Retrieving Images from a Database
Try It Out: Displaying Stored Images
How It Works
Working with Text Data
Try It Out: Loading Text Data from a File
How It Works
Retrieving Data from Text Columns
Summary

CHAPTER 19 Using LINQ
Introduction to LINQ
Architecture of LINQ
LINQ Project Structure
Using LINQ to Objects
Try It Out: Coding a Simple LINQ to Objects Query
How It Works
Using LINQ to SQL
Try It Out: Coding a Simple LINQ to SQL Query
How It Works
Try It Out: Using the where Clause
How It Works
Using LINQ to XML
Try It Out: Coding a Simple LINQ to XML Query
How It Works
Summary

CHAPTER 20 Using ADO.NET 3.5
Understanding ADO.NET 3.5 Entity Framework
Understanding the Entity Data Model
Working with the Entity Data Model
Try It Out: Creating an Entity Data Model
How It Works
Try It Out: Schema Abstraction Using an Entity Data Model
Summary

Wednesday, January 09, 2008

Journey through .NET 1.0 to .NET 3.5

.NET Framework has covered long path and .NET 3.5 is available for developers. In the similar fashion Visual Studio 2008 has also been developed each time to accompany the newly developed .NET Framerowk version.

Lets understand about these evolution of various .NET Framework versions and Visual Studio suite.

.NET Framework --|---Year----|---CLR---|-------Supported VS
----------------------------------------------------------------------------------------
.NET 1.0 -------------2001-------1.0.3705------Visual Studio 2002(Rainer)
.NET 1.1--------------2002-------1.1.4322------Visual Studio 2003(Everett)
.NET 2.0-------------2005-------2.0.50727----Visual Studio 2005(Whidbey)
.NET 3.0-------------2006-------2.0.50727----VS 2005 extensions for.NET 3.0
.NET 3.5-------------2008-------2.0.50727----Visual Studio 2008 (Orcas)
--------------------------------------------------------------------------------------------

.NET 3.0 comes with following brand new features:
* WPF(Windows Presentation Foundation)
* WCF (Windows Communication Foundation)
* WWF or WF(Windows Workflow Foundation)
*WC (Windows Cardspace)

.NET 3.5 comes with following brand new features:
*LINQ (Language Integrated Query)
*ADO .NET 3.5 with Entity Framework
*ASP.NET 3.5