LINQ Useful Links

The Language-Integrated Query (LINQ) covers a set of features that lets you retrieve information from a data source. In many cases, data is stored in a database that is separate from the application. Traditionally, interacting with a relational database would involve generating queries using SQL. Other sources of data, such as XML, would require their own approaches that were completely different. However, LINQ gives C# the ability to generate queries for any LINQ-compatible data source. Furthermore, the syntax used for the query is the same, no matter what data source is used.

The following links are useful to learn the LINQ programing model:

1-      LINQ Official Website

http://msdn.microsoft.com/en-us/netframework/aa904594

2-      LINQ to Everything by Charlie Calvert

http://blogs.msdn.com/b/charlie/archive/2008/02/28/link-to-everything-a-list-of-linq-providers.aspx

3-      Joining LINQ to SQL and LINQ to Excel by Eric White

http://blogs.msdn.com/b/ericwhite/archive/2008/12/04/joining-linq-to-sql-and-linq-to-excel.aspx

4-      Building a LINQ Provider by Pedram Rezaei

http://msdn.microsoft.com/en-us/vcsharp/ee672195.aspx

5-      Dynamic LINQ by Scott Guthrie

http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx

6-      101 LINQ Samples

http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx

7-      LINQ to Facebook

http://www.codeproject.com/KB/aspnet/LinqToFqlAddon.aspx

From C# Learners

8-      LINQ

https://csharplearners.com/category/linq/

More » «LINQ Useful Links»

LINQ and C#

Challenge 
Almost every application uses data in some form, whether the data comes from in memory, databases, XML files, or text files. Many developers find it difficult to switch from strongly typed object-oriented programming to the data access tier in an application. In C#, developers can navigate easily through the namespaces, work with a debugger in the Visual Studio IDE, and more. However, when accessing data, you will notice that things are quite different and more tedious. Developers end up in a world that is not strongly typed, where debugging is a pain or even non existent, and lots of time is spent sending strings to the database as commands. The goal for LINQ was to provide a methodology that simplifies and unifies the implementation of accessing any kind of data. It makes it easier to interact with SQL, relational databases, XML, and the programming languages that communicate with them. LINQ does not force you to use a specific architecture, but facilitates the implementation of several existing architectures for accessing data. Some examples include RAD/prototype, Client/server, N-tier, and Smart client.

Solution 
LINQ stands for Language-Integrated Query and covers a set of features that lets you retrieve information from a data source. In many cases, data is stored in a database that is separate from the application. Traditionally, interacting with a relational database would involve generating queries using SQL (Structured Query Language). Other sources of data, such as XML, would require their own approaches that were completely different. However, LINQ gives C# the ability to generate queries for any LINQ-compatible data source. Furthermore, the syntax used for the query is the same, no matter what data source is used. Accessing a relational database is the same as data stored in an array, and the query capability is fully integrated into the C# language. LINQ in C# is essentially a language within a language and as a result, the subject of LINQ is quite large, involving many features, options, and alternatives. It contains set of standard query operators that provide the underlying query architecture for the navigation, filtering, and execution operations of nearly every kind of data source. LINQ also provides the means for developers to stay within the coding environment that they comfortable with and access the underlying data as objects that work with the IDE, IntelliSense, and even debugging. These aspects, combined with shorter, more meaningful, and expressive syntax boosts developer productivity.

Benefit
LINQ is a lightweight disguise over programmatic data integration. It hardly matters what you are querying against, because queries will be quite similar using a whole new set of procedures and keywords. It gives developers a simplified way to write queries by using a unified query syntax to use regardless of the source of data. It promotes faster development time by removing run-time errors and catching errors at compile time. LINQ is fully integrated with IntelliSense, and supports debugging directly in the development language. Using LINQ, you can query directly against your database and even against the stored procedures that your database exposes. The result of making these set operations, transforms, and constructs first-class operations is a set of methods called the standard query operators. These operators provide query capabilities that include sorting, filtering, aggregation, and projection over a large number of different data sources. LINQ-compatible data sources include LINQ to Objects, LINQ to ADO.NET, LINQ to SQL, LINQ to XML, LINQ to DataSet, and LINQ to Entities. By being able to use LINQ to Objects, C# arrays and collections are treated like databases. This gives developers extensive flexibility and an easy way to query data in the collections. LINQ can be extended to support other data sources such as LINQ to SharePoint, LINQ to Exchange, and LINQ to LDAP. By using LINQ, developers can now enjoy the benefits of a single declarative pattern that can be expressed in any .NET-based programming language, and closes the gap between relational data and object-oriented development.

WPF Useful Links

The Windows Presentation Foundation (WPF) is a graphical display system for Windows. WPF is designed for .NET, influenced by modern display technologies such as HTML and Flash, and hardware-accelerated. It is also the most radical change to hit Windows user interfaces since Windows 95. It allows you to build advanced user interfaces (UIs) that incorporate documents, media, two-dimensional (2D) and three-dimensional (3D) graphics, animations, and weblike characteristics.

In a pre-WPF world, developing a Windows application would have required the use of several different technologies. For instance, in order to add forms and user controls to your application, you needed to use the Windows Forms included in the .NET Framework. You had to use GDI+ to create images and 2D graphics. To add 3D graphics, you would have needed to use Direct3D or OpenGL.

WPF is designed to be a unified solution for application development, providing a seamless integration of different technologies. With WPF, you can create vector graphics or complex animations and incorporate media into your applications to address all of the areas just listed.

The following links are useful to learn the WPF programing model:

1-    WPF Official Website

http://windowsclient.net/wpf/

2-    Pete Brown’s Blog

http://10rem.net/blog

3-    Welcome to the Windows Presentation Foundation Resource Guide

http://www.wpfpedia.com/

More » «WPF Useful Links»

Windows Presentation Foundation

WPF or Windows Presentation Foundation is a new graphical display framework for Windows. This new system is designed to be used by .NET applications and allows the creation of dynamic, interactive graphical user interfaces. One of the most important features of WPF is the integration of DirectX. DirectX provides WPF with the ability to take advantage of the hardware acceleration on today’s graphics cards (GPUs). This allows the graphics load on the CPU to be greatly reduced, while at the same time, expanding the capabilities of the graphical display.

What WPF is and What XAML is

WPF provides a collection of controls such as buttons and grids, which are written in the Extensible Application Markup Language (XAML). XAML is an XML-based markup language created by Microsoft to separate the graphical and interactive elements of application from the main operations in the application, which are written in C# or Visual Basic. The beauty of WPF is how it is able to take advantage of the robustness of C# or Visual Basic, while at the same time using a simple XAML file to create the interface for the application.

The typical way that WPF creates and displays content goes like this:

1. XAML describes how the controls, images, video, and other assets are shown.
2. C# gives these assets their functionality.
3. The compiler then puts the XAML UI and functionality together into an executable (EXE) file for a Windows application or a XAML browser application (XBAP) executable for online applications.
4. The browser or Windows then displays the application.

Service Oriented Architecture (SOA) and WCF

Challenge
As business requirements are always changing, updates and modifications need to be made quickly. In traditional architecture, all components are bundled together, which means to make one update, a number of other components need to be recompiled and redeployed. The processes of gathering requirements, designing, development, QA, and deployment are too long for businesses to wait for, and become actual bottlenecks. To complicate matters further, some business processes are no longer static. Requirements change regularly, and a business needs to be able to redefine its own processes quickly and easily. Existing traditional infrastructure and systems make changes very difficult, but Service Oriented Architecture is an efficient alternative.

Solution
SOA is an architectural design pattern where its design is determined by several guiding principles. Essentially, SOA states that every component of a system should be a service or business process, and the system should be composed of several independent, loosely-coupled services. Services are designed and implemented so that they can serve different purposes or processes, and not just specific ones. The key concepts of SOA are services, high interoperability and loose coupling. SOA is not a specific technology or language, but a system design approach. It is an architecture model that aims to enhance the efficiency, agility, and productivity of an enterprise system. The difference between SOA and other approaches like RPC, DCOM, and CORBA is that SOA is trying to address the problem from the client side, and not from the server side. By decoupling the client side from the server side, the client side application is much easier to develop and maintain. A change to one service does not affect any other service. Also, the deployment of a new service does not affect any existing service. This greatly eases release management and makes SOA very agile. Without SOA, the client-side application is often compiled and deployed along with the server-side applications. This makes it impossible to quickly change anything on the server side. The client-side applications remain tightly coupled with remote objects, and any change to the remote object will still result in a recompiling or redeploying of the client application. However with SOA, the client applications no longer see them as objects, but services.  The client application interacts with these services by exchanging messages, and only knows the interfaces, or protocols of the services.

Benefit
SOA can be implemented by using web services, particularly with WCF services.  WCF is an umbrella technology that covers ASMX web services, .NET remoting, WSE, Enterprise Service, and System.Messaging. WCF is configurable to communicate with web services using both SOAP and XML messages. Because WCF can communicate using web service standards, interoperability is straightforward with other platforms that also support SOAP, such as the leading J2EE-based application servers. It supports a large set of the WS-* specifications, and helps to provide reliability, security, and transactions when communicating with any platform that supports these specifications. Microsoft also developed WCF to be one of the fasted distributed application platforms.
All client applications communicate with a service through its interface, and its interface will remain stable once it is in production. If we have to change the implementation of this service, for example by fixing a bug, or changing an algorithm inside a method of the service, all of the client applications can still work without any change.
When combined with the more mature Business Process Management (BPM) technology, SOA plays an even more important role in an organization’s efforts to achieve agility. Business users can create and maintain processes within BPM, and through SOA they can plug a service into any of the processes. The front-end BPM application is loosely coupled to the back-end SOA system. This combination of BPM and SOA will give an organization much greater flexibility in order to achieve agility.

WCF Useful Links

The Windows Communications Framework (WCF) is a part of the .NET Framework that provides a unified programming model for rapidly building service-oriented applications that communicate across the web and the enterprise.

The following links are useful to learn the WCF programing model:

Overview of WCF

1-      Introduction

http://social.msdn.microsoft.com/Forums/en-SG/tfsbuild/thread/59c4dc2d-1b34-4099-b79d-03e4024fe003

2-      Best Practices: Data Contract Versioning

http://msdn.microsoft.com/en-us/library/ms731060.aspx

3-      Best Practices: Service Versioning

http://msdn.microsoft.com/en-us/library/ee358764.aspx

4-      Configuration-Based Activation in IIS and WAS

http://msdn.microsoft.com/en-us/library/aa751792.aspx

5-      Deploying an Internet Information Services-Hosted WCF Service

http://msdn.microsoft.com/en-us/library/gg258442.aspx

6-      Developing and Deploying WCF Data Services

http://archive.msdn.microsoft.com/AstoriaDocSamples

7-      WCF and TFS 2008 Build Deployment

http://msdn.microsoft.com/en-us/library/ms733832.aspx

More » «WCF Useful Links»

IntelliSense For Expression Blend

Expression Blend 4 provides Intellisense in its code editor in the same way that Visual Studio 2010 does. It offers suggestions for next elements that make sense in the current context. Intellisense in Blend 4 is a little less rich than the version in Visual Studio, offering suggestions a little less frequently. But it does suggest available methods and properties for objects.

Intellisense in its XAML editor
Intellisense in its XAML editor

Blend also provides Intellisense in its XAML editor, suggesting elements and attributes. Notice that it provides a little more information than Intellisense in Visual Studio, when editing XAML.

Intellisense in its XAML editor
Intellisense in its XAML editor

Unfortunately, Blend’s version of Intellisense will not suggest events for XAML elements. Within the context of an element, only its properties are listed. You’re better off adding events using the property pane in Blend, or using Visual Studio 2010 to add event handlers. The version of Intellisense in Visual Studio 2010 does suggest events.

Intellisense in its XAML editor

For Expression Blend 2.5 preview version, the BlendSense can be used for editing XAML files. You can download it from: http://archive.msdn.microsoft.com/BlendSense

Visual Studio 2010 and HTML5

Visual Studio 2010 was originally released without HTML5 support, but VS 2010 SP1 supports HTML5 to some extent. The entire HTML5 specification is not supported but most of the new elements and attributes are. That means you get both intellisense and validation for HTML5 with SP1.

How to turn it on?

After installing SP1 you have to tell Visual Studio to start using the HTML5 schema. Go to Tools -> Options, and then select Text Editor -> HTML -> Validation. You should now be able to select HTML5 or XHTML5 as the target schema or if you have the HTML Source Editing toolbar enabled, you can select it in the target schema dropdown.

CSS3

In SP1 there are a few improvements in the CSS3 support as well, though not as elaborate as with HTML5. The editor now supports the more advanced selectors such as div:nth-child(2n+1) without giving validation errors and the new color values rgba, hsl, hsla and 8 digit hex values are also supported.
Therefore, with Visual Studio today, you can build HTML5 and CSS3 web applications on top of ASP.NET, and with SP1 Microsoft has made it a lot easier for you. All ASP.NET developers are encouraged to start taking advantage of what HTML5 and CSS3 has to offer already today. The Web Platform and Tools team takes web standards very seriously and everybody will see much better support for HTML5 and CSS3 in the future.

C# and Entity Framework Releases

Recently, Rowan Miller, the Program Manager of ADO.NET at Microsoft, pointed out that they have released EF 4.1 Release Candidate (RC), EF Power Tools CTP1, EF June 2011 CTP, EF 4.1 Language Packs, EF 4.1 Update 1 and Code First Migrations August 2011 CTP. The vast majority of the new classes are written in both Visual Basic and C#.

So what will be shipped?

There are two logical parts to the Entity Framework, the core components that ship inside the .NET Framework and Visual Studio, and the ‘out of band’ components that they can update on a much more frequent schedule. The Microsoft ADO.NET team is currently looking at how they can update the core components more frequently as well. The ‘EF June 2011 CTP’ was their first attempt at shipping the core components more often, but are not technically able quite yet.

Some core components include Core EF Runtime and EF Designer. Out of band components include the DbContext API & Code First, T4 Templates for using DbContext API with Model First & Database First, EF Power Tools, and Code First Migrations

Where will be shipped?

As mentioned above, the core components will remain part of the .NET Framework and Visual Studio. The out of band components will be primarily available via NuGet and Visual Studio Gallery.

The DbContext API & Code First will continue to be available as the EntityFramework NuGet package. They no longer plan to provide a stand-alone installer for these components. The NuGet package provides a way to register a GAC or distribute the EntityFramework assembly. T4 Templates for DbContext API will become available on Visual Studio Gallery. In the past they have distributed other T4 templates, such as our POCO templates, by using this mechanism. EF Power Tools will continue to be available on Visual Studio Gallery, and Code First Migrations will continue to be available via NuGet. It’s likely that Microsoft will also release using another mechanism to support team build and deployment scenarios, but currently are still working through the logistics.

NuGet will eventually have built-in support for pre-release versions of packages, but in the meantime will introduce a .Preview version of each package. For example, the EntityFramework package will be the latest fully supported runtime, and EntityFramework.Preview will be the latest preview.

Version Numbers

The version numbers of the core components will be governed by the .NET Framework & Visual Studio release that they are part of. Once a component has had an RTM release (i.e. reached version 1.0.0) all subsequent previews will use the target final release number, along with an ‘alpha’, ‘beta’, etc. special version. For example, they will release EntityFramework.Preview package with a version number of ‘4.2.0beta1’ before releasing EntityFramework with a version number of 4.2.0.

C# and MS Expression Blend Preview in Windows 8

On September 7, Microsoft announced that Expression Blend Preview for Silverlight 5 is available. MS Expression Blend Preview provides support for creating Silverlight 5 projects, including Silverlight 5 SketchFlow projects. Expression Blend Preview for Silverlight 5 installs side-by-side with Expression Blend 4.

Expression Blend Preview for Silverlight 5 supports only Silverlight 5 projects. For Silverlight 3 and 4 projects or WPF 3.5 and 4, please use Expression Blend 4.

You can download it from Microsoft downlaod center:

http://www.microsoft.com/download/en/details.aspx?id=9503

Copyright © All Rights Reserved - C# Learners