Wednesday, July 24, 2013

WCF 3.5 ……!!!!

So what’s new in WCF 3.5, or rather in .net Framework 3.5?
As we all know that WCF was introduced in .net framework 3.0 along with WPF, WWF and CardSpace.
I am trying to put the list of new features in 3.5 with respect to WCF, and very soon all the below will be detailed in other post……

1.      WCF and WF Integration—Workflow Services
2.      Durable Services
3.      WCF Web Programming Model
4.      WCF Syndication
5.      WCF and Partial Trust
6.      WCF and ASP.NET AJAX Integration
7.      Web Services Interoperability

Please click on the above links to read more about them..

Leia Mais…

Tuesday, July 23, 2013

Windows Communication Foundation 3.0


Windows Communication Foundation, we mostly address it as WCF...  Or Indigo.
WCF 3.0: …. I will try to come up with other version of WCF with little or more details ….
To start with WCF 3.0:
Questions in mind (at least these are the questions which I had in my mind ... )..
1.        Why and What is WCF??
2.       So does it mean other distributed system technologies are parked aside??? (Web service [asmx], MSMQ, WSE) etc.
3.        So what's there for a developer??
4.       How do I use WCF???
Hope these little questions are answered by end of this post…
WCF is Microsoft's next-generation programming platform and runtime system for
·         Building
·         Configuring
·         Deploying network-distributed services.
ASMX and WSE: We can build powerful and interoperable service-oriented applications with Web services
MSMQ you have a powerful mechanism for queued messaging that takes care of getting data reliably from one place to the next.
Remoting : The Common Language Runtime (CLR) integrated mechanism for communicating with objects across application domain boundaries and is loved for its very flexible extensibility model, which lets developers rip and replace transports, proxy mechanisms and the way communication channels behave.

I hope we all feel the same for the above list of distributed system technologies ….

All of this is good except that you often have to make an exclusive, explicit choice for one these fundamental technologies.
For instance, if I need any of the features of Enterprise Services and decide to use it, my implementation strategy will be very different from when you use ASMX.
If I need messaging decide to send messages via MSMQ instead of risking to send them via plain HTTP, my code will look vastly different from invoking methods on a method-oriented proxy, unless we add some plumbing/ fixtures  code or use Enterprise Service's Queued Components feature (which brings us back to the previous point).

Now the goal of WCF are that you no longer have to make such technology choices upfront and that you can implement any combination of such requirements on a single technology platform and without resistance.
The promise is that WCF will make developers more productive, because they will only have to master a single programming model that unifies the feature wealth of ASMX, WSE, Enterprise Services, MSMQ, and Remoting.
Point to be noted and feel happy: WCF  is Microsoft's implementation of all these WS-* standards that Microsoft has developed in cooperation with industry partners over the past 5 years—which is promising to ensure broad interoperability across platforms, runtimes and programming languages.

Till here I think we have solid understanding on the first 3 questions... And the next one is how do I use WCF….!!!!



As we all do and say it… we need to know the ABC of xyz J
So here is the: ABC of Windows Communication Foundation
What is the ABC mantra…?
·         "A" stands for Address: Where is the service?
·         "B" stands for Binding: How do I talk to the service?
·         "C" stands for Contract: What can the service do for me?

Developing a WCF service is always a three step process
1.      You define a contract and implement it on a service
2.      You choose or define a service binding that selects a transport along with quality of service, security and other options
3.      You deploy an endpoint for the contract by binding it (using the binding definition, hence the name) to a network address.
Now at this point.. few more questions strike my dirty mind..
1.      Is it possible to expose my service via http and also use SOAP 1.1 and also try to expose it using TCP
2.      Can the above two mentioned end points coexists

The answer of the above 2 questions is a big YES
I will end my post here and will continue with detail explanation of  WCF 3.0 in my next post…

Leia Mais…

Monday, July 22, 2013

Internet Information Services (IIS)

This has been one big question for all the .net developers ….. (at least for web developers)
Questions:
1.       How many versions of IIS do we have?
2.       What are the current versions used?
3.       Which version was released with Which Windows OS and when?
And the list goes on and on….

OK.. to answer all these questions I am trying connect the dots and put them under one roof…
Hope the below list of details help us understand the IIS version
I am not touching IIS 5 and will be only concentrating on version 6 and above.

·    IIS 6 (Windows Server 2003 and Windows XP 64 bit only)
·    IIS 7 (Windows Server 2008 and Windows Vista)
·    IIS 7.5 (Windows Server 2008 R2 and Windows 7)
·    IIS 8 (Windows Server 2012 and Windows 8)

Leia Mais…

Friday, July 5, 2013

Visual Studio 2013 preview


VS 2013 preview :
Check this super cool preview of VS2013 @


http://www.microsoft.com/visualstudio/eng/2013-preview

Leia Mais…

Saturday, February 18, 2012

.Net Framework 3.0

.Net Framework 3.0
With the introduction of .net framework 2.0, application development has seen a huge upside in terms of look and feel and security.
The .NET Framework 3.0 (formerly known as WinFX) released in late 2006. Applications built on this new version of the Framework can be created with Visual Studio 2005, making it feel familiar to most Windows developers.
But the .NET Framework 3.0 is also an evolution, adding more to what version 2.0 of the Framework already provides. Framework 3.0 will be available for Windows Vista, Windows Server 2003, and Windows XP.
Most of the classes in the .NET Framework version 2.0 are unchanged in 3.0/3.5. The key differences for .NET 3.0 are new libraries that offer completely new sets of functionality.
 There are 4 major libraries in the .NET Framework 3.0, which are added to the existing 2.0 Framework libraries.
These 4 libraries are
1.       Windows Presentation Foundation (WPF)
2.       Windows Communication Foundation (WCF)
3.       Windows Workflow Foundation (WF - had to drop one of the W's for legal reasons)
4.       Windows CardSpace




Windows Presentation Foundation (WPF)

WPF gives you a way to differentiate your user experiences. We say UX rather than just UI, as we are talking about more than just a snappy interface. It's about a better user interaction with the application. WPF is also a better experience for developers that want cutting edge UI. Things like having a unified API mean you don't have to learn several APIs to blend media with documents and text, for example. Also, XAML provides a clean, declarative language to describe UI, and to offer designers and developers bridge to share content.

Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF) is a framework for building service-oriented applications. WCF offers a way to do secure, reliable, transacted services using a variety of protocols and bindings.  

Find more details on implementing and using WCF service in my next article on WCF (Sample).

Windows Workflow Foundation (WF)
It is an engine for building applications with workflow. WF serves as the kernel of workflow, handling threading, persistence and other plumbing tasks. WF brings a consistent, component-oriented philosophy to workflow and is already at the core of Microsoft's business in products like SharePoint.

There are two types of workflows provided by WWF.
·         Sequential Workflow
·         State-machine workflow
WWF is made up of the following components:
·         Base Activity Library
·         Runtime Engine
·         Runtime Services
·         Hosts




Windows CardSpace (WS)
Windows CardSpace, originally code-named "InfoCard" is an approach towards representing each identity as a distinct information card.
CardSpace is a solution that lets you pass authentication information around via encrypted tokens rather than typing UID and PWD all over the place. By using visual cueing for recognition, and explicitly differentiating between the relying party and the identity provider, it offers a quick way to effectively authenticate using the WS-* standards. It has a simple, easy to use UI as well. It virtually eliminates phishing problems, and keeps you from having to memorize more and more passwords.


Recourse:

Leia Mais…

.Net Framework 2.0 -----------The Evolution


.Net Framework ….. The Evolution
.net 1.0: Released in the year 2002. With basic support to web and windows development
The .net 2.0 framework is considered to the biggest step in itself. There is a basic question around our minds about the difference in the   .net framework till now.
This is simple effect to clear few of the confusions.

What’s new in .net 2.0 framework

Vs.

What’s new in ASP.net 2.0?????

Let’s first see few of the new features in .net 2.0 framework:
1.      64 bit support:

New support for 64-bit applications enables users to build managed code libraries or easily use unmanaged code libraries on 64-bit computer

2.      Access Control List Support :
An access control list (ACL) is used to grant or revoke permission to access a resource on a computer. New classes have been added to the .NET Framework that allows managed code to create and modify an ACL. New members that use an ACL have been added to the I/O, registry, and threading classes.

3.      ADO.NET
ü  User-defined types (UDT)
ü  Asynchronous database operations
ü  XML data types
ü  Large value types
ü  Snapshot isolation
For more details: What's New in ADO.NET.
4.      Console Class Additions

5.      Data Protection API
The new Data Protection API (DPAPI) includes four methods that allow applications to encrypt passwords, keys, connections strings, and so on, without calling platform invoke. You can also encrypt blocks of memory on computers running Windows Server 2003 or later operating systems.




6.      FTP Support
Applications can now access File Transfer Protocol resources using the WebRequest, WebResponse, and WebClient classes.

7.      Generics and Generic Collections

The .NET Framework 2.0 introduces generics to allow you to create flexible, reusable code. Language features collectively known as generics act as templates that allow classes, structures, interfaces, methods, and delegates to be declared and defined with unspecified, or generic type parameters instead of specific types. Actual types are specified later when the generic is used. Several namespaces, such as System Namespace and System.Collections.Generic, provide generic classes and methods. The new System.Collections.Generic namespace provides support for strongly typed collections. System.Nullable<T> is a standard representation of optional values. Generics are supported in three languages: Visual Basic, C#, and C++.

There are lot other new features like:
1.       I/O Enhancements
2.       .NET Framework Remoting
3.       Security Exceptions
4.       Threading Improvements
5.       XML-Related Features




What's New in ASP.NET 

The Microsoft .NET Framework version 2.0 includes significant enhancements to ASP.NET in virtually all areas. ASP.NET has been improved to provide out-of-the-box support for the most common Web application situations.
Specific areas in which ASP.NET has been improved are:

1.      Productivity.
 You can easily and quickly create ASP.NET Web pages and applications using new ASP.NET server controls and existing controls with new features. New areas such as membership, personalization, and themes provide system-level functionality that would normally require extensive developer coding. Core development scenarios, particularly data, have been addressed by new data controls, no-code binding, and smart data-display controls.

2.       Flexibility and extensibility. Many ASP.NET features are extensible so that you can easily incorporate custom features into applications. The ASP.NET provider model, for example, provides pluggable support for different data sources.

3.       Performance. Features such as precompilation, configurable caching, and SQL cache invalidation allow you to optimize the performance of your Web applications.
Security. It is now easier than ever to add authentication and authorization to your Web applications.

4.       Hosting. ASP.NET includes new features that make it easier to manage a hosting environment and create more opportunities for hosters to add value.
5.       Completeness. New and existing features work in concert to allow you to create end-to-end scenarios that address real-world Web development challenges.




The following sections of this topic describe changes made in different areas of ASP.NET:
1.       Web Site Management:  You can easily manage application settings using the Web Site Administration Tool.
                                                                                            I.            New Administration Features and Tools
                                                                                          II.            Reserved Folders for Special Functionality
                                                                                        III.            App_Code
                                                                                        IV.            App_Data
                                                                                          V.            Precompiling Web Sites for Error Checking and Deployment
                                                                                        VI.            Navigation
You can add site navigation to your Web sites by defining a site map (typically an XML file). You can then use new navigation controls such as the TreeView and SiteMapPath

2.       Page Design
                                                                                            I.            Consistent Layout using Master Pages
                                                                                          II.            Themes for Consistent Appearance
                                                                                        III.            New Code-Behind Model for Pages
                                                                                        IV.            User-Customizable Web Pages
                                                                                          V.            User-Specific Values
                                                                                        VI.            New Caching Features
                                                                                      VII.            Enhanced Client-Side Functionality

3.       Controls
ASP.NET features many improvements to Web server controls, including both enhancements to existing controls and a selection of new controls.

General Control Improvements

A major area of enhancement in ASP.NET 2.0 is in the controls you use to create ASP.NET Web pages. General improvements to controls include:
·         By default, controls now generate markup that is compatible with the XHMTL 1.1. standard.
·         All controls support adaptive rendering, and can emit markup that is appropriate for the requesting browser.
·         All data controls can use either the new data-binding model with data source controls, or can continue to use the model used in earlier versions of ASP.NET.
·         All controls support themes and skins so that you can customize their appearance using an ASP.NET theme.
·         You can use device filtering with many control properties, specifying different property values for different devices. When the control is rendered, the appropriate property value is set based on the requesting browser.
·         Validator controls can now be grouped, which allows you to selectively enable validation for some controls.
·         Improvements to individual controls such as the Label control, ListBox control, and others to add functionality often requested by developers.

New Controls

ASP.NET offers a greater selection of controls to help you create fully featured Web pages much more quickly. You can now take advantage of the following controls:
·         Data. The GridView control is a highly capable data grid that can display and edit data, page, and sort, all without code.
·         Navigation. You can add navigation paths (also known as breadcrumbs) to pages with the SiteMapPath control and display a site map using the TreeView control.
·         Security. You can authenticate users with a suite of login controls that allow you to get and validate user credentials, display custom output for logged-in users, and more. For more information, see Security.
·         Web Parts. A new set of Web Part controls allow you to create portal pages that users can personalize at run time. For example, you can create a Web Part that allows a user to enter a custom value such as a postal code and get localized weather reports.
·         Client behavior. New controls provide ASP.NET server control functionality for tasks that previously were handled only by HTML elements. These include the FileUpload control, ImageMap control, and the HiddenField control. The new Wizard control allow you to create a page with multiple panels that step the user through multi-part forms.

4.      Data

ASP.NET includes substantially improved support for working with data in your Web applications.

Data Source Controls

For binding data to controls on Web pages, you can now use data source controls, which encapsulate connections, query commands, and parameters into a single control.
ASP.NET includes data source controls that work with a variety of back-end data sources, including Microsoft SQL Server, Microsoft Access, XML files, Web services, FrontPage site maps, and business objects that return data sets. All data source controls support the same basic object model, giving you a consistent way to work with data regardless of its source.
Data source controls can automatically fetch data and manage it when the page runs. You no longer need to write code to execute commands and manage datasets for common data scenarios. However, if your application requires it, you still have access to the lower-level data functions exposed by ADO.NET.
To pass parameters to data source controls, you can configure the controls to draw parameters values from other controls, Session state, query strings, or cookies; in addition, you can set parameter values programmatically.

Middle-Tier Data Access

Data Display Controls

·         The GridView , DetailsView , FormView controls to display and edit data. (The GridView control supersedes the DataGrid control from previous versions of ASP.NET.)
·         The TreeView control to display hierarchical information from XML files, sitemap files, and relational data sources.
·         The SiteMapPath and Menu controls to provide data-bound support for navigation.

XML Support

·         You can use XML data in a variety of ways in ASP.NET. An XML data source control exposes

Connection String Storage

·         To enhance Web site security, you can store connection strings in a dedicated section of the configuration file.

5.      Security
New ASP.NET features provide built-in support for authenticating and authorizing users. ASP.NET membership manages authentication, providing facilities for validating user credentials and helping users manage their passwords.

I suggest everyone to have a look at the below link for more practical details

Guys please let me know if the post helped you in understanding or  re-gathering  your thoughts about .net 2.0

Leia Mais…

Monday, February 13, 2012

LINQ and Lambda expression


Hi All,
This is a simple application showing how to use LINQ and Lambda expression 

Step 1:
Create a simple Customer Class:
  public class Customer
        {
            public int Id;public string Name;public string City;
            public Customer(int id, string name, string city)
            {
                Id = id;Name = name;City = city;
            }
        }

Step 2:
Add few customers to the class as below:
List<Customer> customers = new List<Customer>();
            customers.Add(new Customer(1, "Dave", "Sarasota"));
            customers.Add(new Customer(2, "John", "Tampa"));
            customers.Add(new Customer(3, "Abe", "Miami"));

Next we try to write some test method which gets required customer on some condition.
Let’s name it as getCust

Sorry I am not following any naming conventions here J ……


The method looks as below:
This method tries to fetch the result from the list using the below:
·         FirstOtDefault
·         FindAll
·         Find
·         Where
·         select




public static Customer getCust(List<Customer> lcust)
        {
            Customer objcust = null;

            //using simple FirstOtDefault
            objcust = lcust.FirstOrDefault(c => c.Id == 1);

            //Using FindAll
            objcust = lcust.FindAll(c => c.Id == 1).FirstOrDefault();

            //using Predicate and using Find
            Predicate<Customer> pred = item => item.Id == 2;
            objcust = lcust.Find(pred);

            //using Func for Where
            Func<Customer, bool> whereFunc = delegate(Customer cutitemem)
            {
                return cutitemem.Id == 3;
            };

            objcust = lcust.Where(whereFunc).FirstOrDefault();

            //Using simple  LINQ
            var result = from c in lcust
                         where c.Id.Equals(1)
                         select c;
            objcust = result.ToList<Customer>().FirstOrDefault();

            return objcust;
        }
       
 
As you can see the above method shows  different techniques of  using LINQ and Lambda.

ok.. here is the full code :)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleLINQ_Lamda
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Customer> customers = new List<Customer>();
            customers.Add(new Customer(1, "Dave", "Sarasota"));
            customers.Add(new Customer(2, "John", "Tampa"));
            customers.Add(new Customer(3, "Abe", "Miami"));
            Customer abe = getCust(customers);
        }

        public static Customer getCust(List<Customer> lcust)
        {
            Customer objcust = null;
            //using simple FirstOtDefault
            objcust = lcust.FirstOrDefault(c => c.Id == 1);

            //Using FindAll
            objcust = lcust.FindAll(c => c.Id == 1).FirstOrDefault();

            //using Predicate and using Find
            Predicate<Customer> pred = item => item.Id == 2;
            objcust = lcust.Find(pred);

            //using Func for Where
            Func<Customer, bool> whereFunc = delegate(Customer cutitemem)
            {
                return cutitemem.Id == 3;
            };

            objcust = lcust.Where(whereFunc).FirstOrDefault();

            //Using simple  LINQ
            var result = from c in lcust
                         where c.Id.Equals(1)
                         select c;
            objcust = result.ToList<Customer>().FirstOrDefault();

            return objcust;
        }
       
        public class Customer
        {
            public int Id;public string Name;public string City;
            public Customer(int id, string name, string city)
            {
                Id = id;Name = name;City = city;
            }
        }
    }
}

Guys pls do comment n give suggestions on the post .. Thanks in adv

Leia Mais…