<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DkUDRHgzcSp7ImA9WhRaE0U.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521</id><updated>2012-02-16T11:24:35.689+02:00</updated><category term="AOP" /><category term="LINQ" /><category term="Windows Forms" /><category term="Parallelism" /><category term="Custom Paging" /><category term="Project management" /><category term="Microsoft" /><category term="Teamwork" /><category term="Subversion" /><category term="Enterprise Application Concepts" /><category term="GridView" /><category term="Model" /><category term="Business intelligence" /><category term="Cohesion" /><category term="Source Control System" /><category term="Conditional Compilation" /><category term="Active Record" /><category term="Inversion of Control" /><category term="4.0" /><category term="Soft Skills" /><category term="Separation of Concerns" /><category term="Coupling" /><category term="LDAP" /><category term="Business Challenges" /><category term="C#" /><category term="WF" /><category term="MVP Pattern" /><category term="Leadership" /><category term="Active Directory Membership Provider" /><category term="JSON versus XML" /><category term="Parallell Computing" /><category term="WCF" /><category term="Enterprise Library" /><category term="Loosely Coupled" /><category term="Modularity" /><category term="Assembla" /><category term="OOP" /><category term="ADAM" /><category term="Visual Inheritance" /><category term="Patterns" /><category term="Transaction Script" /><category term="Communication" /><category term="JSON" /><category term="dotnet" /><category term="Domain Model" /><category term="preprocessor directives" /><category term="Design Patterns" /><category term="AD" /><title>Stepping into Software Development World</title><subtitle type="html">Step into the development world.
Discover new methods, techniques and ideas to boost your daily work. Feel free to read, add comments, suggest new topics and give your opinions.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.dsoftworld.com/" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/FnIae" /><feedburner:info uri="blogspot/fniae" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>blogspot/FnIae</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;CEAEQXkyfyp7ImA9WhZVGUs.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-8879012773190959064</id><published>2011-06-02T00:11:00.001+03:00</published><updated>2011-06-02T00:11:40.797+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-02T00:11:40.797+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Enterprise Application Concepts" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>The Enterprise Middleware Age</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;Since the growth of the web distributed models have become the de facto standard of the corporate software industry. N -tiered models allowed for the simple decoupling of layers both physically and conceptually. This is so because of the frameworks available that supports their individual technical purposes, as well as because of the lower cost of hardware needed to house these systems. The web model took a firm architectural hold in the early 2000s. Even systems requiring or preferring the use of thick client installations shifted toward an application server to handle business rules external to the database. Yet as these distributed models grew, another technical dilemma surfaced: &lt;a href="http://en.wikipedia.org/wiki/Interoperability" target="_blank"&gt;interoperability&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The world was smaller now, and systems were being developed with communications in mind. Systems were expected to transmit data between servers and PCs to perform even the simplest of business tasks. Businesses increased the number of applications&lt;a name='more'&gt;&lt;/a&gt; they built to support business needs, which now needed to communicate with each other to share logic and services. Even the exchange of data had now complicated a bit as each application required a number of dedicated data servers for redundancy and high availability. Which server was the right one to use? How would a process running on server X know how to access logic from a class on server Y? The answer was the creation of enterprise middleware.&lt;br /&gt;
&lt;br /&gt;
Enterprise middleware can be considered any model that handles the communication of computers between platforms and systems. The job of middleware software is to abstract the consuming systems so that they don’t have to understand the technical particulars of the system they are calling. A Java – based system making a call into a service on a Windows server would do so through the use of a middleware server, which handles the translation between platforms in a manner that isolated one from the other. However, disparate operating systems weren’t the only impediment that made interoperability so difficult. Varying architectures had a similar need for middleware. A system that used a web model for housing application logic would often need to invoke the services of a client application on a limited number of distributed machines. Likewise, client applications often had the need to call into an application server as a web request, even though no implicit web communication model was built into the software. The complexities of interoperability increased dramatically as systems began to depend on isolated servers for broad, comprehensive tasks, such as authentication and authorization. Authentication servers built on the &lt;a href="http://msdn.microsoft.com/en-us/library/aa367008(v=vs.85).aspx" target="_blank"&gt;Lightweight Directory Access Protocol&lt;/a&gt;, or LDAP model, became the standard for network security calls. As more systems began to rely on services from other systems, they also required iterative calls into LDAP servers. Taking this model a step further, increased data needs also lead to increased interoperability demands. Consuming applications in need of data from multiple systems began connecting to different relational database management systems at runtime. Each database had its own security roles and levels of authorization, requiring even more calls into security LDAP servers. Now, even a simple task might require communication between three, four, or even five different systems, each one using its own architecture and technical platforms. &lt;br /&gt;
&lt;br /&gt;
Enterprise middleware evolved with the industry’s communication needs. Early middleware models were somewhat rudimentary. Organizations in need of complex interoperability often attempted to design their own middleware, complete with a set of messages and protocols that were entirely of their own devising. Simple text - based patterns such as string delimiters were used in flat file exchanges to transmit data from one machine to another. The limitations of this approach were almost immediately apparent. As organizations attempted to share system services with other organizations, a considerable amount of work was required to translate the nonstandard message patterns. Even when the translation was in place, maintaining and updating these patterns was a cumbersome task.&lt;br /&gt;
The task of translation was moderately simplified with the emergence of &lt;a href="http://www.w3.org/XML/" target="_blank"&gt;Extensible Markup Language&lt;/a&gt;, or XML, as the primary means of message exchange. XML provided a language pattern for conveying message - based concepts common to all systems. XML ’ s rich format allowed for the defining of data structure, especially pertaining to parent - child relationships inherent to data hierarchies. XML also provided a means for the defining of basic data types, such as integers, strings, and double – precision floats. XML documents such as the Document Type Definition (&lt;a href="http://www.w3schools.com/dtd/default.asp" target="_blank"&gt;DTD&lt;/a&gt;) and XML Schema (XSD) quickly became the industry standard for defining types and applying simple validation to the fields each type supported. All of these patterns eased the pain of defining the system - to - system messages, but designers still needed to come up with their own message structures to match the requisite invocation signatures of the target services. There was no standard methodology for these messages, and there were no mechanisms in place to provide a well - known model to act as a roadmap for new consumers. &lt;br /&gt;
&lt;br /&gt;
The emergence of web services helped to lower the interoperability curve. Web services were one of the first widely embraced machine - to - machine interactions over a network using non - platform – specific conveyances. They provide an open means of invoking methods on another system, most commonly known as a remote procedure call, or RPC. RPC models have been around for quite some time, with support from varying invocation frameworks such as XML - RPC, the Common Object Request Broker Architecture (&lt;a href="http://java.sun.com/developer/onlineTraining/corba/corba.html" target="_blank"&gt;CORBA&lt;/a&gt;), the Distributed Component Object Model (&lt;a href="http://en.wikipedia.org/wiki/Distributed_Component_Object_Model" target="_blank"&gt;DCOM&lt;/a&gt;) and the Java platform’s Remote Method Invocation (&lt;a href="http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136424.html" target="_blank"&gt;RMI&lt;/a&gt;) framework. RPC models can be either synchronous or asynchronous. However, the former has proven to be a more commonly embraced model than the latter. Web services provide a framework for synchronous remote procedure calls over a network and are a useful layer within an enterprise middleware system.&lt;br /&gt;
&lt;br /&gt;
The architecture of a web service can be fairly complex; a full description of web service architecture lies outside of the scope of this book. However, some of the core principles behind them are important keys to understanding enterprise middleware as it has evolved. A true web service exposes a public endpoint often referred to as a web method. A web method uses basic HTTP communication standards for sending text - based data across a network in a format known as Simple Object Access Protocol, or SOAP. &lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/SOAP" target="_blank"&gt;SOAP &lt;/a&gt;messages are written using XML, and expose two key elements: the envelope and the message body. The envelope contains critical metadata about the message being passed, while the body contained the data to be delivered to the service. Web services were also required to publish a service descriptor file, using a pattern known as Web Services Description Language, or WSDL. A WSDL file was served out with the public method, providing up - to - date information and instructions for calling the web method. To discover web services, various service broker models began to pop up, delivering a sort of online yellow pages for available web services. Overall, however, the SOAP model has remained consistent enough to provide organizations with a stable model for requesting and responding to networked service calls.&lt;br /&gt;
Web services helped the software industry realize a level of predictability otherwise unseen in the enterprise community. Since the web service model was both transparent and pervasive, tools began to surface to eliminate the need for developers to understand the service architecture itself. Since the XML was standardized, each development platform could implement features and utilities to automatically create the XML messages and corresponding files on the fly, without forcing the programmer to write a lot of markup to expose their methods.&lt;br /&gt;
Web services on the Windows platform have evolved along with some of the latest web services trends. With the initial release of ASP.NET in the .NET 1.0 Framework (2002) &lt;a href="http://www.microsoft.com/en-us/default.aspx" target="_blank"&gt;Microsoft &lt;/a&gt;provided a mechanism for defining and consuming web services on top of the ASP.NET model with relative ease. Readers with experience using ASP.NET are likely familiar with .asmx files. The .NET SDK came complete with a set of command - line utilities for interrogating online web services using the web standard published by the W3C. These utilities could be used to define web methods in an ASP.NET project, and expose them as public web services in a file known as an .asmx file. These files translated the web method requests and responses into SOAP - based messages and exposed a WSDL file for other downstream consumers. These same utilities could also be used by calling .NET clients to read the published WSDL file and generate a local proxy class through which web methods could be invoked. The generated proxy classes would translate incoming and outgoing messages to and from XML SOAP, eliminating the need for the consuming developer to write any XML messages.&lt;br /&gt;
&lt;br /&gt;
ASP.NET web services were popular for small application data exchange but fell short of delivering an enterprise model for system - to - system interoperability. The tools provided were Microsoft - specific. While they worked well for communicating between Windows applications, there were various technical nuances that made communicating with a non - Windows platform difficult to accomplish. The SOAP messages used were not entirely standardized, leaving developers at a loss when choosing the right SOAP version for their calls. Moreover, the communication model was irregular. The .asmx web service model was built directly on top of the ASP.NET framework, coupling the web service model with the ASP.NET event lifecycle. This added runtime overhead and made maintenance efforts harder. Since then, Microsoft has released the &lt;a href="http://wiki.asp.net/page.aspx/402/windows-communication-foundation/" target="_blank"&gt;Windows Communication Foundation&lt;/a&gt;, or WCF framework. WCF is a framework and API dedicated to all manner of machine - to - machine communication. Like Java and other popular development platforms, WCF aims to unify the communication stack for all Microsoft systems.&lt;br /&gt;
This new communication model is far better suited for growing systems with changing communication needs and is ideal for building true enterprise middleware.&lt;br /&gt;
&lt;br /&gt;
More about Enterprise application will be introduced, specially concerning interoperability...&lt;br /&gt;
Stay Tuned&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-8879012773190959064?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/w7xb4OqWltxc_kT957VtJRACL_Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/w7xb4OqWltxc_kT957VtJRACL_Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/w7xb4OqWltxc_kT957VtJRACL_Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/w7xb4OqWltxc_kT957VtJRACL_Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/kWfR2dQyyYg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/8879012773190959064/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/06/enterprise-middleware-age.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/8879012773190959064?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/8879012773190959064?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/kWfR2dQyyYg/enterprise-middleware-age.html" title="The Enterprise Middleware Age" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/06/enterprise-middleware-age.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4HRnw9cCp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-6189236012132699344</id><published>2011-05-03T00:23:00.004+03:00</published><updated>2011-05-06T01:02:17.268+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:02:17.268+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="WF" /><category scheme="http://www.blogger.com/atom/ns#" term="4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Integrating WCF with WF</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;Workflows are presented in software development as an effective tool for solving problems or accomplishing business goals. By splitting them into smaller and more manageable pieces, they can be coordinated into a single process. Workflows also bring reusability and maintainability — two core quality principles in software engineering. They are promoted by workflows because they have smaller pieces that can be reused across several processes and are easier to maintain. These pieces or reusable assets receive the name of activities, and usually describe the work performed by the people or software involved in the process. When designing workflows within an enterprise application using a bottom - up approach, they are first designed as a set of primitive activities to control the execution flow, communicate with the outside world, or execute actions to change the workflow’s internal state. These workflows can later be converted to activities and used as a compositional unit for creating other workflows that coordinate work at a higher level. In this way, the design process can be applied recursively to a number of abstraction levels that we might find necessary.&lt;br /&gt;
The same design paradigm can be applied in the service - oriented world. A service can be implemented through&lt;a name='more'&gt;&lt;/a&gt;a combination of primitive activities in a workflow, or a service can be the result of a workflow that orchestrates other services to accomplish a business goal.&lt;br /&gt;
For instance, a service for submitting a new order in a supply management application might require the coordination of other services to verify or update the stock level of the ordered product. All the work needed to coordinate these service calls can be modeled through a simple workflow. However, implementing a service as a workflow is not as simple as it sounds. There are challenges that need to be addressed, and without the help of the right technology, they would be almost impossible to achieve: A long - running process that interacts with people might take hours or days to complete. For instance, a service that implements a document approval workflow. For this kind of service, a mechanism is needed to save the workflow state across different service calls. We can’t keep the state in memory forever, as it is volatile storage and a performance bottleneck when the number of running workflows gets high. Multiple messages that represent business events might come in or go out from a given service instance. A mechanism to correlate all these messages into the same service instance is required to resume the workflow execution in the correct step and with the correct state.&lt;br /&gt;
&lt;a href="http://msdn.microsoft.com/en-us/netframework/aa663328" target="_blank"&gt;Workflow Foundation&lt;/a&gt; (WF) is the technology that helps we in this area. Fortunately with the introduction of new activities to build workflow - enabled or workflow services, it has been closely integrated with &lt;a href="http://www.dsoftworld.com/2008/06/wcf-windows-communication-foundation.html" target="_blank"&gt;WCF&lt;/a&gt; in the .NET Framework 3.5. WCF in that sense provides the necessary infrastructure to communicate the workflows with the external world through incoming and outgoing messages.&lt;br /&gt;
Throughout the below, we will see this relationship has been improved in version 4.0 with the introduction of new features such as content correlation, declarative services, and the new runtime model and activity library.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;ANATOMY OF A WORKFLOW SERVICE&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A workflow service created with &lt;a href="http://en.wikipedia.org/wiki/Windows_Workflow_Foundation" target="_blank"&gt;WF&lt;/a&gt; maintains state, gets input messages from and sends output messages to the outside world, and executes code that performs the service ’ s work. This is the same as an ordinary stateful service, which preserves a shared state between different operations during its lifetime.&lt;br /&gt;
Every workflow service has an outermost activity, the workflow itself, which contains all other activities. This outer activity can take different shapes, and basically determines the way the execution flow goes through different inner activities. &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/145be744-e3d8-4fd1-8f39-c3f0407f2d78/" target="_blank"&gt;WF 4.0&lt;/a&gt; ships with two built - in activities for modeling workflows: a sequence activity that flows from one activity to the next until the last activity is executed, and a flowchart activity that resembles the concepts that many analysts and application designers go through when creating solutions or designing business processes.&lt;br /&gt;
&lt;br /&gt;
we should also understand that the WF runtime does not know anything about the internal implementation of the activities it is executing, or the way it behaves. It can only run one activity after another, until the last activity is reached. It can also persist the workflow state at certain points. Now, we might wonder why we should go with a workflow service when the same service can be implemented manually with code? The answer is, to address some of the benefits that WF can give in this area:&lt;br /&gt;
The automatic support for long - running workflows that the WF infrastructure provides is the most evident benefit. The execution of a long - running workflow can be suspended or resumed on multiple points, so the internal state of the execution and activities must be preserved. WF automatically takes cares of saving the workflow state through the use of configurable providers. Therefore, we do not need to worry about these details.&lt;br /&gt;
The implementation of a complex service that orchestrates several other services with a certain degree of parallelism gets simplified with the use of a workflow. All the aspects related to message correlation are automatically handled by the WF infrastructure. The same implementation made purely on code would require a lot of plumbing code and some knowledge about concurrent programming. This is necessary to be efficient when coordinating all the service calls and correlating all the responses in the same way WF would do it. &lt;br /&gt;
A service might need to execute some kind of compensation logic or be suspended when an unexpected situation or exception occurs during its execution. For instance, a service that depends on other services to perform an action might not be able to complete its execution when any of these are not available, which might lead to some data inconsistencies. If we use a workflow to implement this service, the workflow itself can be suspended and restarted later when the dependent services are available.&lt;br /&gt;
The declarative model and visual designer that WF provides becomes handy at the moment of building simple services without worrying about implementation details of the WCF ABC (Address, Binding, and Contract). We can focus on a declarative model that simply creates variables that are handled in the workflow, and activities that initialize these variables and change their values, sending them to the outside world.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;DECLARATIVE SERVICES&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One of the main problems of implementing workflow services in the &lt;a href="http://en.wikipedia.org/wiki/.NET_Framework" target="_blank"&gt;.NET Framework 3.5&lt;/a&gt; is that the integration between these technologies leaves something to be desired. We basically have to define all the WCF artifacts using the WCF programming and configuration model, and the workflow using a different model, resulting in a set of multiple artifacts that need to be deployed and managed separately.&lt;br /&gt;
However, with the .NET Framework 4.0, we can define all the WCF artifacts, such as contracts and operations, using &lt;a href="http://msdn.microsoft.com/en-us/library/ms752059.aspx" target="_blank"&gt;XAML&lt;/a&gt; (eXtensible Application Markup Language) together with the workflow definition in the same language, resulting in a single artifact — a XAML - based service. In other words, we essentially create a model of the service defining what the service should do, rather than writing code to specify how to do it — the traditional way to do things in .NET.&lt;br /&gt;
Below is the XAML representation of a workflow service with a simple operation, GetData , that receives an input argument in the variable "data" and returns a string ( data.ToString() ). As we can see, all the activities have been represented as objects with properties using the XAML notation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt; WorkflowService ConfigurationName=&amp;quot;Service1&amp;quot; Name=&amp;quot;Service1&amp;quot; .... &amp;gt;&lt;br /&gt;
&amp;lt; p:Sequence DisplayName=&amp;quot;Sequential Service&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt; p:Sequence.Variables &amp;gt;&lt;br /&gt;
&amp;lt; p:Variable x:TypeArguments=&amp;quot;CorrelationHandle&amp;quot; Name=&amp;quot;handle&amp;quot; / &amp;gt;&lt;br /&gt;
&amp;lt; p:Variable x:TypeArguments=&amp;quot;x:Int32&amp;quot; Name=&amp;quot;data&amp;quot; / &amp;gt;&lt;br /&gt;
&amp;lt; /p:Sequence.Variables &amp;gt;&lt;br /&gt;
&amp;lt; Receive x:Name=&amp;quot;__ReferenceID0&amp;quot; DisplayName=&amp;quot;ReceiveRequest&amp;quot;&lt;br /&gt;
OperationName=&amp;quot;GetData&amp;quot; ServiceContractName=&amp;quot;contract:IService&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt; Receive.CorrelationInitializers &amp;gt;&lt;br /&gt;
&amp;lt; RequestReplyCorrelationInitializer CorrelationHandle=&amp;quot;[handle]&amp;quot; / &amp;gt;&lt;br /&gt;
&amp;lt; /Receive.CorrelationInitializers &amp;gt;&lt;br /&gt;
&amp;lt; ReceiveMessageContent &amp;gt;&lt;br /&gt;
&amp;lt; p:OutArgument x:TypeArguments=&amp;quot;x:Int32&amp;quot; &amp;gt; [data] &amp;lt; /p:OutArgument &amp;gt;&lt;br /&gt;
&amp;lt; /ReceiveMessageContent &amp;gt;&lt;br /&gt;
&amp;lt; /Receive &amp;gt;&lt;br /&gt;
&amp;lt; SendReply Request=&amp;quot;{x:Reference Name=__ReferenceID0}&amp;quot;&lt;br /&gt;
DisplayName=&amp;quot;SendResponse&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt; SendMessageContent &amp;gt;&lt;br /&gt;
&amp;lt; p:InArgument x:TypeArguments=&amp;quot;x:String&amp;quot; &amp;gt; [data.ToString()] &amp;lt; /p:InArgument &amp;gt;&lt;br /&gt;
&amp;lt; /SendMessageContent &amp;gt;&lt;br /&gt;
&amp;lt; /SendReply &amp;gt;&lt;br /&gt;
&amp;lt; /p:Sequence &amp;gt;&lt;br /&gt;
&amp;lt; /WorkflowService &amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the contract and operations for this service are automatically inferred from the Receive Activity definition. A great advantage of having a fully declarative service is that we can store the complete definition in a service repository and take full control of the workflow’s instances from a hosting environment such as Windows AppFabric.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;IMPLEMENTING OUR FIRST WORKFLOW SERVICE&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
We have seen some introductory theories behind workflow services and the messaging activities that can be used in this kind of service to receive messages or invoke external services. It is now time to jump into a more concrete example to see a workflow service in action. This example represents the implementation of a service for entering purchase orders into a system. For practical purposes, this service will also invoke an external service for every received order. Let’s start creating a C# class library for including the definition of the contract and implementation of the external service invoked within the workflow service. The implementation is simple enough: it receives the product that was ordered, the quantity associated to the order, and returns a Boolean value specifying the success of the operation. See below&lt;br /&gt;
&lt;br /&gt;
[ServiceContract]&lt;br /&gt;
public interface IProductNotification&lt;br /&gt;
{&lt;br /&gt;
[OperationContract]&lt;br /&gt;
bool Notify(string product, int quantity);&lt;br /&gt;
}&lt;br /&gt;
public class ProductNotification : IProductNotification&lt;br /&gt;
{&lt;br /&gt;
public bool Notify(string product, int quantity)&lt;br /&gt;
{&lt;br /&gt;
return true;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Now that we have the external service implementation, we can focus on the implementation of the first workflow service. Visual Studio 2010 provides a template WCF Workflow Service Application under the Workflow category, which we can use to create workflow services from scratch. When that template is selected and executed, a new web project is generated with a sample workflow service definition that includes a pair of Receive/Send Activities. Start the implementation of your workflow service by removing those activities.&lt;br /&gt;
This service will initially receive a purchase order as it is defined in the PurchaseOrder data contract check below through a new Receive Activity that we need to create in the workflow. This activity basically represents the initial entry point for the service.&lt;br /&gt;
&lt;br /&gt;
[DataContract]&lt;br /&gt;
public class PurchaseOrder&lt;br /&gt;
{&lt;br /&gt;
[DataMember]&lt;br /&gt;
public string Customer { get; set; }&lt;br /&gt;
[DataMember]&lt;br /&gt;
public string Product { get; set; }&lt;br /&gt;
[DataMember]&lt;br /&gt;
public int Quantity { get; set; }&lt;br /&gt;
[DataMember]&lt;br /&gt;
public decimal UnitPrice { get; set; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
We should set the Receive Activity properties with the values specified below &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;PROPERTY&lt;/b&gt;                    &lt;b&gt;VALUE
&lt;/b&gt;DisplayName                 SubmitPOReceive
OperationName               SubmitPO
ServiceContractName         IPurchaseOrder
CanCreateInstance           True
Content                     PurchaseOrder
&lt;/pre&gt;&lt;br /&gt;
Leave the rest of the properties with the default values. The designer will complain that the PurchaseOrder variable is not defined, and that is exactly what we do next. The variables can be defined for a workflow instance in the Variables tab, which usually appears at the bottom margin of the designer. A variable definition is made of three parts: a name, a type, and a scope. The variables, as in any language, are referenced by name, and the type is any valid CLR type shipped as part of the framework or a type created for us. In this case, we define a variable called PurchaseOrder whose type is PurchaseOrder (a data contract defined in another project) and is scoped to the current workflow service (Sequential workflow service). As we can see, we have a single data contract parameter to receive all the information, so Message Data is just fine for that purpose. In case we want to support multiple arguments in the operation signature, we need to use parameters and assign them to the corresponding variables or use VB expressions to do more complex assignments. &lt;br /&gt;
The workflow is now ready to start receiving messages containing the purchase order information through the operation SubmitPO . As we haven’t defined a SendReply Activity, this operation momentarily behaves as one - way. The next step is to invoke the ProductNotification service for every receive order. The easy way to include that service call in the existing workflow is to use the automatic generated activity. The only thing to do is add a service reference for ProductNotification When the reference is added to the project, we should be able to see a new activity called Notify with a public interface that resembles the Notify operation in the IProductNotify contract. It has two public properties for setting the product and quantity respectively, and a third property for getting access to the operation return value. We can drag and drop that activity after the Receive Activity and fill out the properties with the values in the below list&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;PROPERTY &lt;/b&gt;              &lt;b&gt;VALUE
&lt;/b&gt;NotifyResult           NotifyResult
Product                PurchaseOrder.Product
Quantity               PurchaseOrder.Quantity
&lt;/pre&gt;&lt;br /&gt;
NotifyResult is a new Boolean variable that needs to be defined to receive the result of the operation. The Product and Quantity input arguments are initialized from the existing variable PurchaseOrder by using expressions.&lt;br /&gt;
&lt;br /&gt;
Last but not least, we need to create a new SendReply Activity from the SubmitPOReceive Receive Activity to send the results back to the client. The only thing needed is to set up this activity in the Content property to use Message data and True as value, so it will basically return a value indicating the operation was executed successfully.&lt;br /&gt;
At this point, the workflow service is ready to use, and any client can access the service WSDL by browsing the POService.xamlx file directly in the corresponding web host (IIS virtual directory or Visual Studio web server). This means that the service behaves as any other WCF service from the point of view of a client application, and a tool such as svcutil can be used to generate the proxy classes to consume it.&lt;br /&gt;
&lt;br /&gt;
PurchaseOrderClient client = new PurchaseOrderClient();&lt;br /&gt;
bool? result = client.SubmitPO(new ServiceReference.PurchaseOrder&lt;br /&gt;
{&lt;br /&gt;
Customer = "John BarFoo",&lt;br /&gt;
Product = "myproduct",&lt;br /&gt;
Quantity = 10,&lt;br /&gt;
UnitPrice = 1&lt;br /&gt;
});&lt;br /&gt;
Console.WriteLine(result.GetValueOrDefault());&lt;br /&gt;
&lt;br /&gt;
Hope this small demonstration has opened a gate to this approach, stay tuned more examples to come.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-6189236012132699344?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KoLTZBsfF-URPxoJsVpTZhc1puc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KoLTZBsfF-URPxoJsVpTZhc1puc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KoLTZBsfF-URPxoJsVpTZhc1puc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KoLTZBsfF-URPxoJsVpTZhc1puc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/7MMrSXmNmvA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/6189236012132699344/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/05/integrating-wcf-with-wf.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/6189236012132699344?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/6189236012132699344?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/7MMrSXmNmvA/integrating-wcf-with-wf.html" title="Integrating WCF with WF" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/05/integrating-wcf-with-wf.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYNRno5fyp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-5363753402044366508</id><published>2011-05-01T13:34:00.001+03:00</published><updated>2011-05-06T01:06:37.427+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:06:37.427+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>The .NET Platform</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;The .NET platform is Microsoft’s development platform for Windows and the cloud. This includes support for desktop applications, smart device applications, server and database applications, web applications and services, and cloud applications deployed to Windows Azure. &lt;br /&gt;
In addition, the technology is available in more exotic corners of computer science, ranging from operating system implementation (for example, Microsoft Research’s Singularity research operating system) to gaming with the XNA framework and Microsoft Robotics Studio for robotics. Figure below gives an overview of the .NET platform &lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-BNWa9RqPKzY/TbvyLWxeTdI/AAAAAAAAAFo/tawI4aKy6Kk/s1600/DotNet.JPG" imageanchor="1" &gt;&lt;img border="0" height="219" width="320" src="http://1.bp.blogspot.com/-BNWa9RqPKzY/TbvyLWxeTdI/AAAAAAAAAFo/tawI4aKy6Kk/s320/DotNet.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let’s point out the key features and advantages of the .NET platform as a whole:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Object-oriented programming:&lt;/strong&gt; Recognized to be the current paradigm of choice to master complexity, the platform was built&lt;a name='more'&gt;&lt;/a&gt; around the concepts of object-oriented programming (OO). The core of languages like C# are based on the OO principles, and the OO paradigm is used as the glue that makes language interoperability possible.&lt;br /&gt;
&lt;br /&gt;
Support for multiple languages: Although COM supported multiple languages (most notably C++ and Visual Basic) in order to talk together, its cross-language capabilities were limited to implementing interfaces. In .NET, true interoperability between languages becomes possible with capabilities such as cross-language inheritance. Together with a unified type system, this makes integration between code written in different languages totally seamless. This also accommodates other programming language paradigms, ranging from a functional programming style (as seen in F#, but nowadays in certain C# and Visual Basic language features too) to dynamic languages (such as Ruby and Python).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Easy component-based development:&lt;/strong&gt; The art of creating components containing libraries and sharable pieces of application functionality is much simpler in .NET than it was before. No COM interfaces like IUnknown need to be implemented, and no registration is required. The unit of code sharing in .NET is based on the concept of an assembly, which carries version info and all the metadata required to use it. This eliminates the need to have separate header files and such.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Simplified application deployment:&lt;/strong&gt; In contrast to COM-based components, no registration is required to deploy assemblies; just “xcopy deployment” suffices. In addition to this, the DLL hell has been eliminated by supporting multiple versions of the same component to exist side by side. The .NET Framework itself is a good example of this capability, because it’s possible to have multiple versions of the framework installed next to one another on the same machine.&lt;br /&gt;
&lt;br /&gt;
Rich base class library support: The .NET Framework comes with a rich set of class libraries that provide basic building blocks to build rich applications, all of which are provided in a consistent manner and designed based on OO principles. Examples of such libraries include collections, text manipulation, database access, file system manipulation, networking, XML support, rich service-oriented communication stacks, windowing systems, and so on. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Various application types:&lt;/strong&gt; Thanks to the rich base class library (BCL), it becomes incredibly easy to write all sorts of applications based on the same framework foundation. Support is provided for Windows desktop GUI applications (Windows Forms&lt;br /&gt;
and Windows Presentation Foundation [WPF]), web applications (ASP.NET), web services (Windows Communication Foundation [WCF]), smart device applications&lt;br /&gt;
(Compact Framework), browser and Windows Phone 7 applications (Silverlight), cloud applications for Windows Azure, and more.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Unified runtime infrastructure:&lt;/strong&gt; At the core of the .NET Framework sits the Common Language Runtime (CLR), which provides unified runtime infrastructure in the form of an intermediate language (IL) shared by all languages that run on the platform, Just-in-Time (JIT) compilation of such IL code to native code for the machine on which it’s running, automatic memory management through a garbage collector (GC), assembly loading services, debugging services, threading, and so on. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Interoperability with existing code:&lt;/strong&gt; Although the .NET platform is meant to be a solid replacement for older technologies, it’s quintessential to have good support to reuse existing software components that were written in older technologies like COM and to provide access to native operating system Win32 API functions through a mechanism called P/Invoke.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Exception handling:&lt;/strong&gt; Error handling in the .NET Framework is provided through a mechanism known as exception handling. This eliminates many of the worries associated with manual error checking as done in Win32 programming and COM-based&lt;br /&gt;
APIs with so-called HRESULTs. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Improved security model:&lt;/strong&gt; With the advent of the Web, deployment of code becomes a severe security risk. To mitigate this, the .NET runtime has a built-in security mechanism called Code Access Security (CAS) that sandboxes code based on the code’s origin, publisher evidence, and configurable policies. This security model is orthogonal to the security mechanisms provided by the operating system, such as access control lists (ACLs) and Windows security tokens.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Web services capabilities:&lt;/strong&gt; Right from the start of the .NET Framework, the platform has had support for web services as a modern way of performing cross-platform remote procedure calls based on Simple Object Access Protocol (SOAP) and Extensible Markup Language (XML) standards. All this is provided using programming paradigms that feel natural in the world of .NET, so developers do not require a fundamentally different mindset to deal with web services. Over the years, the web services support on the .NET Framework has grown significantly with support for the WS-* set of web services standards. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Professional tooling support:&lt;/strong&gt; Visual Studio 2010 is the latest version of the toolset that accompanies the .NET Framework to provide professional support for the development of various types of applications with rich designer support, unit testing frameworks, a project and build system (MSBuild), and, thanks to the unified runtime infrastructure, rich debugging support can be provided for the cross-language platform of .NET. The higher-end editions of Visual Studio, Premium and Ultimate, are aimed at team development in conjunction with a server product called Team Foundation Server (TFS) used for work-item tracking, source-control, project-reporting, and document-sharing capabilities. Starting with the 2010 release, you can also install TFS on client operating systems, which allows individual professional developers to benefit from things such as source control.&lt;br /&gt;
&lt;br /&gt;
Stay tuned&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-5363753402044366508?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/B74dpOdcG5-L2EqujoH0PvO-ze0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B74dpOdcG5-L2EqujoH0PvO-ze0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/B74dpOdcG5-L2EqujoH0PvO-ze0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B74dpOdcG5-L2EqujoH0PvO-ze0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/wTi9vDwhI0I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/5363753402044366508/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/05/net-platform.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/5363753402044366508?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/5363753402044366508?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/wTi9vDwhI0I/net-platform.html" title="The .NET Platform" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-BNWa9RqPKzY/TbvyLWxeTdI/AAAAAAAAAFo/tawI4aKy6Kk/s72-c/DotNet.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/05/net-platform.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYEQH48cSp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-2833880799655650593</id><published>2011-04-16T13:00:00.001+03:00</published><updated>2011-05-06T01:05:01.079+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:05:01.079+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Model" /><category scheme="http://www.blogger.com/atom/ns#" term="Patterns" /><category scheme="http://www.blogger.com/atom/ns#" term="Transaction Script" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="Active Record" /><category scheme="http://www.blogger.com/atom/ns#" term="Domain Model" /><title>Application Middleware Design</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;&lt;strong&gt;Business Logic Layer&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The business logic layer is an abstract layer that contains all the rules, workflow and validation that define and deal with the business complexities that your software has been designed to meet. Typically, the business logic layer will fit between your user interface, service, or presentation layer and your data access layer. By separating the business logic from other layers in your applications you are separating your concerns and keeping your code loosely coupled and allowing for different implementations to be used with the business logic layer; for example, changing the UI from a web application to a WPF application.&lt;br /&gt;
&lt;br /&gt;
WPF Win Forms --- Web Forms --- Other Services&lt;br /&gt;
-------------------------------------------------------------------&lt;br /&gt;
Service Layer&lt;br /&gt;
-------------------------------------------------------------------&lt;br /&gt;
Business Logic Layer&lt;br /&gt;
-------------------------------------------------------------------&lt;br /&gt;
Data Access Layer&lt;br /&gt;
-------------------------------------------------------------------&lt;br /&gt;
Data Sources&lt;br /&gt;
&lt;br /&gt;
Depending on the complexities of the business model that your application has been designed for, the structure of your business logic layer may differ considerably. For instance a complex banking application will have a rich Domain Model that represents the real banking domain with hundreds of small business entities representing loans, customers, and accounts. For a simpler application, such as a blogging engine, you may have a number of fairly simple business objects that map very closely to your &lt;a name='more'&gt;&lt;/a&gt;underlying Data Model with little or no business logic, simply acting as a method to add and retrieve data. In the next section, you will look at the various patterns at your disposal to structure your business logic layer.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Patterns for Your Business&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
There are a number of design patterns that you can follow that will help you to organize your business logic. In the below part, you will be introduced to three of the main patterns found in the business logic layer: the Transaction Script, Active Record, and the Domain Model pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Transaction Script&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Transaction Script is a very simple business design pattern, which follows a procedural style of development rather than an object - oriented approach. Simply create a single procedure for each of your business transactions with each procedure containing all of the business logic that is required to complete the business transaction from the workflow, business rules, and validation checks to persistence in the database.&lt;br /&gt;
One of the strengths of the Transaction Script pattern is that it is very simple to understand and clear to see what is going on without any prior knowledge of the pattern. If a new business case needs to be handled, it is straightforward enough to add a new method to handle it, which will contain all of the related business logic.&lt;br /&gt;
&lt;br /&gt;
The problems with the Transaction Script pattern are revealed when an application grows and the business complexities increase. It is very easy to see many management or application classes with hundreds of fine - grained transaction methods that map directly to a business use cases. Sub methods can be used to avoid repetitive code such as the validation and business rules, but duplication in the workflow cannot be avoided, and the code base can quickly become unwieldy and unmanageable as the application grows.&lt;br /&gt;
&lt;br /&gt;
If you have a simple application with minimal business logic, which doesn’t warrant a fully object - oriented approach, the Transaction Script pattern can be a good fit. However, if your application will grow, you may need to rethink your business logic structure and look to a more scalable pattern like the Active Record pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Active Record Pattern&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The Active Record pattern is very popular pattern and is especially effective when your underlying database model matches your business model. Typically, a business object will exist for each table in your database. &lt;br /&gt;
The Active Record pattern is great for very simple applications where there is a one-to-one mapping between the Data Model and the Business Model, such as with a blogging or a forum engine; it ’ s also a good pattern to use if you have an existing database model or tend to build applications with a “ data first ” approach. Because the business objects have a one - to - one mapping to the tables in the database and all have the same CRUD (create, read, update, and delete) methods, it ’ s possible to use code generation tools to auto - generate your business model for you. Good code gen tools will also build in all of the database validation logic to ensure that you are allowing only valid data to be persisted. &lt;br /&gt;
&lt;br /&gt;
However, the Active Record pattern is no silver bullet. It excels with a good underlying Data Model that maps to the business model, but when there is a mismatch, sometimes called an impedance mismatch, the pattern can struggle to cope. This is the result of complex systems sometimes having a very different conceptual business models than the Data Model. When there is a rich business domain with lots of complex rules, logic, and workflow, this favors going with the Domain Model approach.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Domain Model Pattern&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
You can think of a Domain Model as a conceptual layer that represents the domain you are working in. Things exist in this model and have relationships to other things. What do I mean by things? Well, for example, if you were building an e - commerce store, the “things” that would live in the model would represent a Basket, Order, and Order Item, and the like. If you were creating a loan application, you would have representations for a Borrower, Loan, Assets, and Debts. It’s these things that have data and, more importantly, behavior. Not only would an order have properties that represent a creation date, status, and order number, but it would also contain the business logic to apply a voucher to, including all of the domain rules that surround it — Is the voucher valid? Can the voucher be used with the products in the basket? Are there any other offers in place that would render the voucher invalid, and so forth. The closer your Domain Model represents the real domain the better, as it will be easier for you to understand and replicate the complex business logic, rules, and validation process. &lt;br /&gt;
&lt;br /&gt;
The main difference between the Domain Model and the Active Record pattern is that the business entities that live in the Domain Model have no knowledge of how to persist themselves, and there doesn’t necessarily need to be one - to - one mapping between the Data Model and the Business Model.&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, the Domain Model, unlike the Active Record pattern, has no knowledge of persistence. The term &lt;a href="http://msdn.microsoft.com/en-us/magazine/dd882510.aspx" target="_blank"&gt;persistence ignorant&lt;/a&gt; (PI) has been coined for the plain nature of the &lt;a href="http://en.wikipedia.org/wiki/Plain_Old_CLR_Object" target="_blank"&gt;POCO&lt;/a&gt;(plain old common runtime object) business entities. How then do you persist a business object with the Domain Model? &lt;br /&gt;
&lt;br /&gt;
Typically, the repository pattern is used. When you are employing the Domain Model pattern, it’s the responsibility of the Repository object, along with a data mapper, to map a business entity and its object graph of associated entities to the Data Model. Be aware that business entities inside the Domain Model are PI.&lt;br /&gt;
&lt;br /&gt;
Trying to solve complex business problems in software is difficult, but when using the Domain Model pattern, you first create an abstract model of the real business model. With this model in place, you can then model complex logic by following the real domain and recreating the workflow and processing in your Domain Model. Another advantage that a Domain Model holds over the Transaction Script and the Active Record patterns is that, because it contains no data access code, it can be easily unit tested without having to mock and stub out dependencies of such a data access layer.&lt;br /&gt;
&lt;br /&gt;
Again, the Domain Model pattern may not always be a great fit for your application needs. One of its great strengths is dealing with complex business logic, but a full - blown Domain Model is architectural overkill when very little business logic is contained within the application. Another disadvantage of the pattern is the steep learning curve needed to become proficient in it compared to the Active Record and Transaction Script options. To use the pattern effectively takes time and experience and, most importantly, a sound knowledge of the business domain you are trying to model.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Which Pattern to Use?&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Each pattern has its pros and cons, and there is no one method that will suit all of your development needs. Let’s take a brief look at each pattern and see when it’s most appropriate to use it. &lt;br /&gt;
&lt;br /&gt;
&lt;im&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff648226.aspx" target="_blank"&gt;Transaction Script&lt;/a&gt;&lt;im&gt;: If you have a simple application with little or no logic, then Transaction Script is a great choice as a straightforward solution that is easily understood by other developers picking up your code down the line.&lt;br /&gt;
&lt;br /&gt;
&lt;im&gt;&lt;a href="http://en.wikipedia.org/wiki/Active_record_pattern" target="_blank"&gt;Active Record&lt;/a&gt;&lt;/im&gt;: If your business layer is simply a thin veil over the top of your database, then this is a great pattern to opt for. There are many code generation tools that can automatically create your business objects for you based on your database schema, and it ’ s not too difficult to create your own.&lt;br /&gt;
&lt;br /&gt;
&lt;im&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/ee236415.aspx" target="_blank"&gt;Domain Model&lt;/a&gt;&lt;/im&gt;: The Domain Model excels when you have an involved, rich complex business domain to model. It’s a pure object - oriented approach that involves creating an abstract model of the real business domain and is very useful when dealing with complex logic and workflow.&lt;br /&gt;
The Domain Model is persistence ignorant and relies on mapper classes and the Repository pattern to persist and retrieve business entities.&lt;br /&gt;
&lt;br /&gt;
It now your decision how to implement your application’s Middleware. But keep in mind that a good design will calculate the support time and application extensibility.&lt;br /&gt;
&lt;br /&gt;
Stay tuned for more, and share it with your Development cycle.&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-2833880799655650593?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/70dCxCye-cxyeZpmo8nmxg0q1t8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/70dCxCye-cxyeZpmo8nmxg0q1t8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/70dCxCye-cxyeZpmo8nmxg0q1t8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/70dCxCye-cxyeZpmo8nmxg0q1t8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/O_TqtkuD5jA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/2833880799655650593/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/04/application-middleware-design.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/2833880799655650593?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/2833880799655650593?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/O_TqtkuD5jA/application-middleware-design.html" title="Application Middleware Design" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/04/application-middleware-design.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYGRnc6fyp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-1448792116758429480</id><published>2011-04-12T00:36:00.002+03:00</published><updated>2011-05-06T01:05:27.917+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:05:27.917+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Business intelligence" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="Business Challenges" /><title>Business Intelligence</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;Business intelligence (BI) refers to computer-based techniques used in identifying, extracting, and analyzing business data, such as sales revenue by products and/or departments, or by associated costs and incomes.&lt;br /&gt;
BI technologies provide historical, current and predictive views of business operations. Common functions of business intelligence technologies are reporting, online analytical processing, analytics, data mining, business performance management, benchmarking, and text mining and predictive analytics.&lt;br /&gt;
Business intelligence aims to support better business decision-making. Thus a BI system can be called a decision support system (DSS).Though the term business intelligence is sometimes used as a synonym for competitive intelligence, because they both support decision making, BI uses technologies, processes, and applications to analyze mostly internal, structured data and business processes while competitive intelligence gathers, analyzes and disseminates information with a topical focus on company competitors. Business intelligence understood broadly can include&lt;a name='more'&gt;&lt;/a&gt;the subset of competitive intelligence &lt;a href="http://en.wikipedia.org/wiki/Business_intelligence"&gt;(previous definition from Wikipedia)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Business Challenges:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
-Data is stored in a number of different systems on different platforms, such as inventory and logistics in SAP, financials in Oracle, web analytics in SQL Server, and manufacturing on the mainframe. This can make data difficult to get to, require multiple accounts for access, and keep teams and departments at arm’s length from each other.&lt;br /&gt;
&lt;br /&gt;
-Pockets of knowledge about the data are spread throughout teams that don’t regularly interact. This spread causes data to be analyzed in different ways and metrics to be calculated inconsistently, which, in turn, leads to unpredictable analysis and inappropriate actions being taken based on the data.&lt;br /&gt;
&lt;br /&gt;
-Documentation is limited or nonexistent. Many times documentation is not created for reports or the metadata underneath them, and this lack of documentation is a critical problem. If you don’t know where the data is coming from for the report, or how certain metrics are being calculated, then you can’t truly understand or communicate the value of the data and calculations.&lt;br /&gt;
&lt;br /&gt;
-Consolidated reporting is very time-consuming, when it is possible at all. With reports coming from so many different places, you run into the same problems mentioned in the previous point. These challenges require more people to know different reporting systems, lead to more administrative headaches, and so on. &lt;br /&gt;
&lt;br /&gt;
-Reporting teams spend significant time finding and aligning data instead of analyzing and mining it for actionable information. If reporting teams need to go out and gather data from across the company constantly, this doesn’t leave much time for analyzing and interpreting the data. These challenges cause many reporting teams to rework large portions of their reports several times as opposed to spending that time understanding what the users are asking for and delivering more actionable information. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;How Intelligent Is Your Organization?&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Business Intelligence (BI) is a term that encompasses the process of getting your data out of the disparate systems and into a unified model, so you can use the tools in the Microsoft BI stack to analyze, report, and mine the data. Once you organize your company’s data properly, you can begin to find information that will help you make actionable reports and decisions based on how the data from across your organization lines up. For instance, you can answer questions like, “How do delays in my manufacturing or distribution affect my sales and customer confidence?” Answers like this come from aligning logistics data with sales and marketing data, which, without a Business Intelligence solution, would require you to spend time exporting data from several systems and combining it into some form that you could consume with Excel, or another reporting tool.&lt;br /&gt;
&lt;br /&gt;
Business Intelligence systems take this repetitive activity out of your life. BI automates the extracting, transforming, and loading (ETL) process and puts the data in a dimensional model that sets you up to be able to use cutting-edge techniques and everyday tools like Microsoft Excel to analyze, report on, and deliver results from your data.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Getting Intelligence from Data&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
How do you get information from data? First, you need to understand the difference. As you learned earlier, data can come from many different places, but information requires context and provides the basis for action and decision-making. Identifying your data, transforming it, and using the tools and techniques you learn will enable you to provide actionable information out of the mass of data your organization stores. There are several ways to transform your data into actionable information and each has its pros and cons.&lt;br /&gt;
Typical solutions for reporting include a few different architectures:&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Departmental reporting:&lt;/em&gt; Many organizations have their own departmental reporting environments. This situation leads to a significant increase in licensing costs, since using different vendors for each department and reporting environment increases spending on hardware and software licensing, end-user training, and ramp-up time. &lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Individual data access&lt;/em&gt;: Some organizations find it easier to grant lots of individual user’s access to the data. This is not only dangerous from a security perspective, but likely to lead to performance problems, because users are not the most adept at creating their own queries in code. Also, with all the industry and federal compliance and regulation governing data access, widespread access can quickly lead to a security audit failure, especially in a publicly held company.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;BI add-on from each vendor&lt;/em&gt;: When teams seek out and apply different strategies, it exacerbates the original problem of data being all over the organization. The data will still be segmented, and additionally the analysis on it will be inconsistent and applied based on each team’s individual understanding of how its data fits into the enterprise, instead of the correct view based on the organizational goals.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Automated reports from different systems:&lt;/em&gt; It may be nice to get the automated reports and they likely serve a purpose, but they usually cannot be counted on to run an enterprise.&lt;br /&gt;
Strategic reporting, dashboard drill-through, and detailed analysis require a BI implementation to support them and provide the “at your fingertips” data and analysis that your end users, managers, and executives are craving.&lt;br /&gt;
&lt;br /&gt;
You have likely seen some form of all of these problems in your organization. These are the opposite of what you want to accomplish with a great BI infrastructure.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;BI to the Rescue&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
A well-thought-out BI strategy will mitigate the problems inherent to each of the previously listed approaches. A good BI approach should provide the targeted departmental reporting that is required by those end users while adjusting the data so it can be consumed by executives through a consolidated set of reports, ad hoc analysis using Excel, or a SharePoint dashboard. Business Intelligence provides a combination of automated reporting, dashboard capabilities, and ad hoc capabilities that will propel your organization forward.&lt;br /&gt;
&lt;br /&gt;
BI provides a single source of truth that can make meetings and discussions immediately more productive.&lt;br /&gt;
How many times have you gotten a spreadsheet via e‑mail before a meeting and shown up to find that everyone had his or her own version of the spreadsheet with different numbers? Business Intelligence standardizes organizational calculations, while still giving you the flexibility to add your own and enhance the company standard. These capabilities allow everyone to speak the same language when it comes to company metrics and to the way the data should be measured across the enterprise or department.&lt;br /&gt;
Integrating Business Intelligence with your organization’s current reporting strategy will improve the quality of the data as well as the accuracy of the analysis and the speed at which you can perform it. Using a combination of a data warehouse and BI analytics from Analysis Services and Excel, you can also perform in-depth data mining against your data. This enables you to utilize forecasting, data-cluster analysis, fraud detection, and other great approaches to analyze and forecast actions. Data mining is incredibly useful for things like analyzing sales trends, detecting credit fraud, and filling in empty values based on historical analysis. This powerful capability is delivered right through Excel, using Analysis Services for the back-end modeling and mining engine. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;BI = Business Investment&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
A focused Business Intelligence plan can streamline the costs of reporting and business analytics. The Microsoft BI stack does a great job of providing you with the entire tool set for success within SQL Server Enterprise Edition. We provide more details on that shortly, but the most important bit of information you should take away right now is that the cost of managing multiple products and versions of reporting solutions to meet departmental needs is always higher than the cost of a cohesive strategy that employs one effective licensing policy from a single vendor. When organizations cannot agree or get together on their data strategy, you need to bring them together for the good of the organization. In the authors’ experience, this single, cohesive approach to reporting is often a gateway to a successful BI implementation. Realizing the 360-degree value of that approach and seeing the value it can have in your organization are the two most important first steps.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Microsoft’s Business Intelligence Stack&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Microsoft’s Business Intelligence stack comes with SQL Server and is greatly enhanced with the addition of SharePoint Server.&lt;br /&gt;
We will discuss the SQL Server Integration Services (SSIS) in upcoming articles, mean while you have the topic and you can do research more and deep about it. Stay tuned…&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-1448792116758429480?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IhNo4ZUiw8Ima0YOSogJYF7kkok/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IhNo4ZUiw8Ima0YOSogJYF7kkok/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IhNo4ZUiw8Ima0YOSogJYF7kkok/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IhNo4ZUiw8Ima0YOSogJYF7kkok/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/RLEdCX5NV4U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/1448792116758429480/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/04/business-intelligence.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/1448792116758429480?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/1448792116758429480?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/RLEdCX5NV4U/business-intelligence.html" title="Business Intelligence" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/04/business-intelligence.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYMSH4-eyp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-7631320366910242376</id><published>2011-04-07T09:31:00.003+03:00</published><updated>2011-05-06T01:06:29.053+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:06:29.053+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Enterprise Application Concepts" /><category scheme="http://www.blogger.com/atom/ns#" term="Loosely Coupled" /><category scheme="http://www.blogger.com/atom/ns#" term="Modularity" /><category scheme="http://www.blogger.com/atom/ns#" term="Inversion of Control" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>The Enterprise Application Concepts</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;Most people who begin learning enterprise development find that the best place to begin is the code. Readers should be familiar with a third generation object - oriented (&lt;a href="http://en.wikipedia.org/wiki/Object-oriented_programming" target="_blank"&gt;OO&lt;/a&gt;) language to fully grasp some of the concepts discussed here. &lt;br /&gt;
After reading this article hopefully, you’ll become familiar with some pretty slick tools, some of which produce some pretty fancy behaviors. Yet these tools are each meant as a complement to a well - designed code base. Without good code design, these tools are rendered useless; many will fail to function at all. The reason for this failure is that a well – designed enterprise system should be constructed using code that adheres to one of the core values of enterprise design: separation of concerns. To achieve the correct degree of separation, developers should strive to write their code with a strong degree of modularity and loose coupling. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Modularity&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The notion of code separation is one of the single most important facets of enterprise development.&lt;br /&gt;
Traditional Microsoft developers have at their fingertips a wide array of powerful &lt;a href="http://en.wikipedia.org/wiki/List_of_rapid_application_development_tools" target="_blank"&gt;RAD tools&lt;/a&gt; that empower them to quickly automate macros and execute applications. Unfortunately, these tools don’t enforce a strong degree of modularity. Although&lt;a name='more'&gt;&lt;/a&gt;the code produces a desired result, the result is limited and not entirely reusable. Well - designed code must be broken down and divided into separate “vehicles of purpose.” In the enterprise world, these are known as units of codes. &lt;br /&gt;
Units of code are typically classes or types designed with a specific purpose in mind. The purpose should be well focused, striving to achieve the single desired goal for which the type was initially designed. As various units of code are developed, they can be designed to interact with one another in a manner that achieves a larger desired effect without violating the rules that drive their division. &lt;br /&gt;
We know that this sounds pretty confusing at first, but take heart — most seasoned Microsoft developers still have a tough time thinking in terms of true separation. When it comes to developing business applications the vast majority of us are wired to think of the desired outcome and then work backward.&lt;br /&gt;
Think about most of the business requirements for which you’ve developed code. A manager or project leader gives you the task of building a thing that does X. You then work backward from X, constructing the code line by line in your mind until you have a rough roadmap for a prototype. You then translate this roadmap into whatever code gets the desired outcome the quickest in order to produce the results for the tasking manager. Yet this process skips the critical step of assessing code design before you write the code. The result is a pile of spaghetti code that isn’t reusable and, moreover, isn’t testable. &lt;br /&gt;
In cases such as these, it is critical for the developer to assess the design early, and understand the individual elements that will be needed to make the system function. &lt;br /&gt;
Consider a requirement where you are tasked with creating a small client application that creates automated email newsletters advertising discounted auto parts. You ’ re given a list of discounting rules based on the location where a user lives, and a small desktop database containing the list of automotive parts and their prices. Another database is given to you containing a list of user emails and the geographic location from which each user hails. Finally, you’re provided with a brief list of preferred styles for HTML - compliant email clients. Generally speaking, an application like this is a no brainer. Most developers experienced with Microsoft Office automation or simple ET.NET forms programming could create a console application that gets the job done in a handful of function calls. Yet the resulting code is unorganized. It combines UI styles, database calls, and business rules into one convoluted stack of code. &lt;br /&gt;
Most developers have experimented with some modularity in the past. You might have moved recursive calls into a separate function, maybe created a class or two for accessing data, or perhaps you’ve dabbled with some object - oriented design patterns, like a Factory model or Decorator pattern. Wouldn’t these deliver an acceptable amount of modularity? Not necessarily. Patterns such as these do provide a useful means of separation; however, when developing enterprise systems modularity isn’t just about separation of your code for reusability. Enterprise development typically requires a strong degree of loose coupling.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Loosely Coupled Classes&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Loose coupling is a pattern that embraces a high degree of entity separation. It describes a resilient relationship between two or more objects or systems where information can be exchanged or invoked with minimal dependency on one another. The term dependency can be used to describe a number of different aspects of reliance between two things, some of which may be more valid than others. In the case of enterprise development, a dependency is typically used to describe a runtime need for one class by another. The goal of loose coupling is to minimize these runtime links.&lt;br /&gt;
When it comes to enterprise development, loose coupling may be one of the strangest shifts you’ll make when coding. Up until now you’ve likely been quite comfortable with a very traditional flavor of object - oriented programming. You define classes that perform various tasks, and provision them with attributes accordingly. The class might need some form of initialization so that you code a constructor that creates new objects, connects to different services, and populates properties accordingly. This approach is fine for small systems, but it ’ s far from ideal for a large system that interacts with multiple services and consumers. The problem with this approach is that it prevents the creation of autonomous units. Recall that a unit of code is a class or entity designed to perform a single task. If a unit of code requires the consuming of services from other parts of the system, these services should be passed into the unit abstractly. It should never be the job of a unit to create the dependencies it needs. Right about now you’re likely sporting a tightly furrowed brow and a nasty, doubting scowl on your face. Object - oriented design has embraced the heavy constructor model for years. Some of the best books on C++ and C# list countless examples of classes that instantiate their own object instances. After all, isn’t that a facet of well - encapsulated design? The answer of course is yes. All of the tenets of OO design still stand firm. Encapsulation and abstraction are still driving factors of your code design. &lt;a href="http://support.microsoft.com/kb/318185" target="_blank"&gt;Loose coupling&lt;/a&gt; does not aim to bend the time - honored rules of OO design; rather, it serves to embrace them at a new level. It combines OO methodologies and patterns with a much stronger degree of modularity.&lt;br /&gt;
This approach not only yields much more reusability but also enables the designer to achieve perhaps the most important theme of enterprise programming: testability. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Unit Testing&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The term unit testing has come to mean many different things over the years. Conceptually, the definition remains the same. A unit test is construct or method for testing the smallest or most finite pieces of your source code. The application of unit tests has varied widely over time. This is especially true when one realizes that the use of unit tests depends entirely on the scope and design of one’s code. There are plenty of systems that do not embrace enterprise programming tenets but that still use unit tests to verify physical layers, individual components, background processes, or other layers that can be divorced from the running system. The problem with this approach is the highly arbitrary nature of the unit. In these looser interpretations of unit tests, the scope of validation usually includes a number of different processes, preventing the ability to truly test at a level where useful action can be taken.&lt;br /&gt;
More recent uses of the term unit testing have come to focus on not only the high modular unit of testable code but also on the methodology of testing. In Test Driven Development, or TDD, the developer focuses on writing unit test first, prior to the code it is intended to validate. The programmer then writes the code to fit the test and refractors both in an iterative process. &lt;br /&gt;
In the enterprise world, unit tests are pieces of code that complement the modular pieces that make up a system. They almost always employ the use of a unit – testing framework, which is ostensibly another code library with methods that enable test automation. Here in lies one of the fundamental differences between older unit testing and Test Driven Development. The automation of tests is an integral part of the build process. As tests are written and new code checked into your code repository, tests are run against the new code and old code to ensure the durability of the new version of the system. This automation process ensures that developers are quickly alerted of any new code that breaks a previously valid system.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Inversion of Control Containers&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
As you begin to develop more and more decoupled code, you’ll no doubt begin to feel some strain. Older object - oriented patterns allowed for the provisioning or initialization of complex objects within an object’s constructor. This ensured that, when an object was created, all of its requisite dependencies were created and initialized as well, all from one line of consumer code. The result was simple to use and easy to proliferate. Now, when you strive to decouple your dependencies, you’ll find yourself constantly creating and passing objects into other objects. That’s fine the first time you define your object graph, but it gets very tedious over time. To resolve this tedium, enterprise developers employ the use of an Inversion of Control (IoC) container.&lt;br /&gt;
IoC containers, also known as &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163739.aspx" target="_blank"&gt;Dependency Injection&lt;/a&gt; (DI) containers, help to maintain code modularity while automating a lot of the logic developers would otherwise need to write themselves. They can seem confusing at first as they seem to hide a lot of visible processing. However once you become accustomed to their patterns, they save a lot of time and frustration. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://research.microsoft.com/en-us/um/people/cszypers/events/wcop2006/wcop06_renaux.pdf" target="_blank"&gt;The Enterprise Application Design&lt;/a&gt; is still evolving more and more with time, I could not elaborate more on the above but sure you can find a lot of examples online just by providing simple keywords in any search engine.&lt;br /&gt;
&lt;br /&gt;
Keep up the good work and stay tuned&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-7631320366910242376?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CtFNntyTHSOQ0UM-JhVCc0R4aec/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CtFNntyTHSOQ0UM-JhVCc0R4aec/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CtFNntyTHSOQ0UM-JhVCc0R4aec/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CtFNntyTHSOQ0UM-JhVCc0R4aec/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/GwexCdzZ80g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/7631320366910242376/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/04/enterprise-application-concepts.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/7631320366910242376?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/7631320366910242376?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/GwexCdzZ80g/enterprise-application-concepts.html" title="The Enterprise Application Concepts" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/04/enterprise-application-concepts.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMHSH46eCp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-3087746077698704031</id><published>2011-03-31T00:30:00.007+03:00</published><updated>2011-05-06T01:10:39.010+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:10:39.010+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="AOP" /><category scheme="http://www.blogger.com/atom/ns#" term="Enterprise Library" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Aspect-Oriented Programming</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;The inherent limitations of the OO paradigm were identified quite a few years ago, not many years after the introduction of OOP. However, today AOP still is not widely implemented even though everybody agrees on the benefits it produces. The main reason for such a limited adoption is essentially the lack of proper tools. We are pretty sure the day that AOP is (even only partially) supported by the .NET platform will represent a watershed in the history of AOP.&lt;br /&gt;
&lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/AspectJ" target="_blank"&gt;Wikipedia&lt;/a&gt;: &lt;/i&gt;&lt;i&gt;Gregor Kiczales started and led the Xerox PARC team that eventually developed AspectJ&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Cross-Cutting Concerns&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
AOP is about separating the implementation of cross-cutting concerns from the implementation of core concerns. For example, AOP is about separating a logger class from a task class so that multiple task classes can use the same logger and in different ways.&lt;br /&gt;
We have seen that dependency injection techniques allow you to inject—and quite easily, indeed—external dependencies in a class. A cross-cutting concern (for example, logging) can certainly be seen as an external dependency. So where's the problem?&lt;br /&gt;
Dependency injection requires up-front design or refactoring, which is not always&lt;a name='more'&gt;&lt;/a&gt; entirely possible in a large project or during the update of a legacy system.&lt;br /&gt;
In AOP, you wrap up a cross-cutting concern in a new component called an aspect. An aspect is a reusable component that encapsulates the behavior that multiple classes in your project require.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Processing Aspects&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In a classic OOP scenario, your project is made of a number of source files, each implementing one or more classes, including those representing a cross-cutting concern such as logging. &lt;br /&gt;
In an AOP scenario, on the other hand, aspects are not directly processed by the compiler. Aspects are in some way merged into the regular source code up to the point of producing code that can be processed by the compiler. If you are inclined to employ AspectJ, you use the Java programming language to write your classes and the AspectJ language to write aspects. AspectJ supports a custom syntax through which you indicate the expected behavior for the aspect. For example, a logging aspect might specify that it will log before and after a certain method is invoked and will validate input data, throwing an exception in case of invalid data.&lt;br /&gt;
&lt;br /&gt;
In other words, an aspect describes a piece of standard and reusable code that you might want to inject in existing classes without touching the source code of these classes.&lt;br /&gt;
&lt;br /&gt;
In the AspectJ jargon, the weaver is a sort of preprocessor that takes aspects and weaves their content with classes. It produces output that the compiler can render to an executable.&lt;br /&gt;
&lt;br /&gt;
In other AOP-like frameworks, you might not find an explicit weaver tool. However, in any case, the content of an aspect is always processed by the framework and results in some form of code injection. This is radically different from dependency injection. We mean that the code declared in an aspect will be invoked at some specific points in the body of classes that require that aspect.&lt;br /&gt;
&lt;br /&gt;
Before we discuss an example in .NET, we need to introduce a few specific terms and clarify their intended meaning. These concepts and terms come from the original definition of AOP. We suggest that you do not try to map them literally to a specific AOP framework. We suggest, instead, that you try to understand the concepts—the pillars of AOP—and then use this knowledge to better and more quickly understand the details of a particular framework.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Inside AOP Aspects&lt;/strong&gt;&lt;br /&gt;
&lt;div class="MsoNormal"&gt;&lt;br /&gt;
As mentioned, an aspect is the implementation of a cross-cutting concern. In the definition of an aspect, you need to specify advice to apply at specific join points.&lt;br /&gt;
&lt;br /&gt;
A join point represents a point in the class that requires the aspect. It can be the invocation of a method, the body of a method or the getter/setter of a property, or an exception handler. In general, a join point indicates the point where you want to inject the aspect's code.&lt;br /&gt;
&lt;br /&gt;
A pointcut represents a collection of join points. In AspectJ, pointcuts are defined by criteria using method names and wildcards. A sample pointcut might indicate that you group all calls to methods whose name begins with Get.&lt;br /&gt;
&lt;br /&gt;
An advice refers to the code to inject in the target class. The code can be injected before, after, and around the join point. An advice is associated with a pointcut.&lt;br /&gt;
Here's a quick example of an aspect defined using AspectJ:&lt;br /&gt;
public aspect MyAspect&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; // Define a pointcut matched by all methods in the application whose name begins with&lt;br /&gt;
&amp;nbsp; // Get and accepting no arguments. (There are many other ways to define criteria.)&lt;br /&gt;
&amp;nbsp; public pointcut allGetMethods ():&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call (* Get*() );&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // Define an advice to run before any join points that matches the specified pointcut.&lt;br /&gt;
&amp;nbsp; before(): allGetMethods()&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do your cross-cutting concern stuff here&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // for example, log about the method being executed&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
The weaver processes the aspect along with the source code (regular class-based source code) and generates raw material for the compiler. The code actually compiled ensures that an advice is invoked automatically by the AOP runtime whenever the execution flow reaches a join point in the matching pointcut.&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="MsoNormal"&gt;AOP can be implemented in dot net using the Microsoft's Policy Injection Application Block in Enterprise Library 3.0 and higher. You can check it on &lt;a href="http://msdn.microsoft.com/en-us/magazine/gg490353.aspx" target="_blank"&gt;MSDN Magazine&lt;/a&gt;&amp;nbsp; or at &lt;a href="http://www.programminghelp.com/programming/dotnet/c-microsoft-enterprise-library-policy-injection/" target="_blank"&gt;Programming Help&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="MsoNormal"&gt;Hoping that this topic has brought to you a wider vision about AOP, stay tuned for some examples of implementing AOP in Dot Net 4.0&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-3087746077698704031?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ki3yjKyLsmrrRKaeWNme-F-KiDs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ki3yjKyLsmrrRKaeWNme-F-KiDs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ki3yjKyLsmrrRKaeWNme-F-KiDs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ki3yjKyLsmrrRKaeWNme-F-KiDs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/qXETGnpE8EM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/3087746077698704031/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/03/aspect-oriented-programming.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/3087746077698704031?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/3087746077698704031?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/qXETGnpE8EM/aspect-oriented-programming.html" title="Aspect-Oriented Programming" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/03/aspect-oriented-programming.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYCRHs-eSp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-3122029441687667817</id><published>2011-03-27T02:41:00.003+03:00</published><updated>2011-05-06T01:06:05.551+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:06:05.551+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Coupling" /><category scheme="http://www.blogger.com/atom/ns#" term="Cohesion" /><category scheme="http://www.blogger.com/atom/ns#" term="Separation of Concerns" /><category scheme="http://www.blogger.com/atom/ns#" term="Modularity" /><category scheme="http://www.blogger.com/atom/ns#" term="OOP" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Universal Software Principles</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;Maintainability is the fundamental attribute of modern software. The importance of maintainability spans the technology spectrum and applies to the Web as well as desktop applications.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A few universally valid design principles help significantly to produce code that is easier to maintain and evolve. It is curious to note that they are all principles devised and formulated a few decades ago. Apparently, for quite some time we’ve had the tools to build and manage complex software but real applications were just lacking the complexity to bring them to the forefront as design best practices. This is also my interpretation of the advent of the Rapid Application Development (RAD) paradigm a decade ago, which complemented (and in some cases superseded) object-oriented programming (OOP). &lt;br /&gt;
&lt;br /&gt;
Today, the situation is different. With large companies now taking full advantage of Internet, cloud, and mobile computing, developers and architects are swamped with an incredible amount of complexity to deal with. That’s why RAD is no longer sufficient in many scenarios. On the other hand,&lt;a name='more'&gt;&lt;/a&gt; not everybody is skilled enough to use OOP. It’s about time we all rediscover some fundamentals of software programming—regardless of the type of application we’re building.&lt;br /&gt;
&lt;br /&gt;
Summarizing, I would boil software principles down to two principles: the High Cohesion and Low Coupling principle and the Separation of Concerns principle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Cohesion and Coupling&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Cohesion and coupling go hand in hand even though they refer to orthogonal aspects of your code. Cohesion leads you toward simple components made of logically related functions—kind of atomic components. Coupling indicates the surface area between two interfacing components: the wider the area is, the deeper the dependency is between the components. The magic is all in finding the right balance between cohesion and coupling while trying to maximize both.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Cohesion at a Glance&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Cohesion indicates that a given software module—a class, if we assume the object-oriented paradigm—features a set of responsibilities that are strongly related. Put another way, cohesion measures the distance between the logic expressed by the various methods on a class.&lt;br /&gt;
&lt;br /&gt;
If you look for a moment at the definition of cohesion in another field—chemistry—you can get a clearer picture of software cohesion. In chemistry, cohesion is a physical property of a substance that indicates the attraction existing between like-molecules within a body.&lt;br /&gt;
&lt;br /&gt;
Cohesion measurement ranges from low to high, with the highest possible cohesion being preferable. Highly cohesive modules favor maintenance and reusability because they tend to have no dependencies. Low cohesion, on the other hand, makes it much harder to understand the purpose of a class, and it creates a natural habitat for rigidity and fragility in your software. Low-cohesive modules also propagate dependencies, thus contributing to the immobility and viscosity of the design.&lt;br /&gt;
&lt;br /&gt;
Decreasing cohesion leads to creating classes where methods have very little in common and refer to distinct and unrelated activities. Translated into a practical guideline, the principle of cohesion recommends creating extremely specialized classes with few methods that refer to logically related operations. If the “logical” distance between methods needs to grow, well, you just create a new class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Coupling at a Glance&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Coupling measures the level of dependency existing between two software classes.&lt;br /&gt;
&lt;br /&gt;
An excellent description of coupling comes from the &lt;a href="http://c2.com/cgi/wiki?CouplingAndCohesion"&gt;Cunningham wiki&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Two classes, A and B, are coupled when it turns out that you have to make changes to B every time you make any change to A. In other words, B is not directly and logically involved in the change being made to module A. &lt;br /&gt;
&lt;br /&gt;
However, because of the underlying dependency B is forced to change; otherwise, the code won’t compile any longer.&lt;br /&gt;
&lt;br /&gt;
Coupling measurement ranges from low to high, with the lowest possible coupling being preferable.&lt;br /&gt;
&lt;br /&gt;
Low coupling doesn’t mean that your modules have to be completely isolated from one another. They are definitely allowed to communicate, but they should do that through a set of well-defined and stable interfaces. Each class should be able to work without intimate knowledge of the internal implementation of another class. You don’t want to fight coupling between components; you just want to keep it under control. A fully disconnected system is sort of nonsense today.&lt;br /&gt;
&lt;br /&gt;
Conversely, high coupling hinders testing and reusing and makes understanding the system nontrivial. It is also one of the primary causes of a rigid and fragile design. &lt;br /&gt;
&lt;br /&gt;
Low coupling and high cohesion are strongly correlated. A system designed to achieve low coupling and high cohesion generally meets the requirements of high readability, maintainability, easy testing, and good reuse.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Separation of Concerns&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Functional to achieving high cohesion and low coupling is the separation of concerns (SoC) principle, introduced by Edsger W. Dijkstra in his paper “On the role of scientific thought” which dates back to 1974. If you’re interested, you can download &lt;a href="http://www.cs.utexas.edu/users/EWD/ewd04xx/EWD447.PDF"&gt;the full paper&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Identifying the Concerns&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
SoC is all about breaking the system into distinct and possibly non-overlapping features. Each feature you want in the system represents a concern and an aspect of the system. Terms like feature, concern, and aspect are generally considered synonyms. Concerns are mapped to software modules and, to the extent that it is possible, there’s no duplication of functionalities.&lt;br /&gt;
&lt;br /&gt;
SoC suggests that you focus your attention on one particular concern at a time. It doesn’t mean, of course, that you ignore all other concerns of the system. More simply, after you’ve assigned a concern to a software module, you focus on building that module. From the perspective of that module, any other concerns are irrelevant.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Modularity&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
SoC is concretely achieved through modular code and making large use of information hiding.&lt;br /&gt;
Modular programming encourages the use of separate modules for each significant feature.&lt;br /&gt;
Modules are given their own public interface to communicate with other modules and can contain internal chunks of information for private use.&lt;br /&gt;
&lt;br /&gt;
Only members in the public interface are visible to other modules. Internal data is either not exposed or it is encapsulated and exposed in a filtered manner. The implementation of the interface contains the behavior of the module, whose details are not known or accessible to other modules.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Information Hiding&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Information hiding (IH) is a general design principle that refers to hiding behind a stable interface some implementation details of a software module that are subject to change. In this way, connected modules continue to see the same fixed interface and are unaffected by changes.&lt;br /&gt;
&lt;br /&gt;
A typical application of the information hiding principle is the implementation of properties in Microsoft C# or Visual Basic .NET classes. The property name represents the stable interface through which callers refer to an internal value. The class can obtain the value in various ways (for example, from a private field, from a control property, from a cache, and from the view state in ASP.NET) and can even change this implementation detail without breaking external code.&lt;br /&gt;
&lt;br /&gt;
Information hiding is often referred to as encapsulation. I like to distinguish between the principle and its practical applications. In the realm of object-oriented programming, encapsulation is definitely an application of IH.&lt;br /&gt;
&lt;br /&gt;
In general, though, the principle of SoC manifests itself in different ways in different programming paradigms, and so it is also for modularity and information hiding.&lt;br /&gt;
&lt;br /&gt;
I guess some of you know these principles, but others not so let's act community &lt;br /&gt;
Stay Tuned :)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-3122029441687667817?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ivDNJzLRM9zbzG2l5JpIOtahAEE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ivDNJzLRM9zbzG2l5JpIOtahAEE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ivDNJzLRM9zbzG2l5JpIOtahAEE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ivDNJzLRM9zbzG2l5JpIOtahAEE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/V5LibvaQk8c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/3122029441687667817/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/03/universal-software-principles.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/3122029441687667817?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/3122029441687667817?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/V5LibvaQk8c/universal-software-principles.html" title="Universal Software Principles" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/03/universal-software-principles.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMDQ3Y8cSp7ImA9WhZXFk4.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-7943515602906956874</id><published>2011-03-22T01:30:00.003+02:00</published><updated>2011-05-06T01:11:12.879+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-06T01:11:12.879+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Conditional Compilation" /><category scheme="http://www.blogger.com/atom/ns#" term="preprocessor directives" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Preprocessor Directives C# 4.0</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;&lt;strong&gt;&lt;span style="font-size: large;"&gt;What Are Preprocessor Directives?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The source code specifies the definition of a program. The preprocessor directives instruct the compiler how to treat the source code. For example, under certain conditions, you might want the compiler to ignore portions of the code, and under other conditions, you might want that code compiled. The preprocessor directives give you those options and several others.&lt;br /&gt;
&lt;br /&gt;
In C and C++ there is an actual preprocessor phase, in which the preprocessor goes through the source code and prepares an output stream of text to be processed by the subsequent compilation phase. In C# there is no actual preprocessor. The “preprocessor” directives are handled by the compiler. The term, however, remains.&lt;br /&gt;
Preprocessor List:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#define identifier&lt;/strong&gt;: Defines a compilation symbol&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#undef identifier&lt;/strong&gt;: Undefines a compilation symbol&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#if expression&lt;/strong&gt;: If the expression is true, compiles the following section&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#elif expression&lt;/strong&gt;: If the expression is true, compiles the following section&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#else&lt;/strong&gt;: If the previous #if or #elif expression is false, compiles the following section&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#endif&lt;/strong&gt;: Marks the end of an #if construct&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#region name&lt;/strong&gt;: Marks the beginning of a region of code; has no compilation effect&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#endregion name&lt;/strong&gt;: Marks the end of a region of code; has no compilation effect&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#warning message&lt;/strong&gt;: Displays a compile-time warning message&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#error message&lt;/strong&gt;: Displays a compile-time error message&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#line indicator Changes&lt;/strong&gt;: the line numbers displayed in compiler messages&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;#pragma text&lt;/strong&gt;: Specifies information about the program context&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;em&gt;The #define and #undef Directives&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
A compilation symbol is an identifier that has only two possible states. It is either defined or undefined. A compilation symbol has the following characteristics:&lt;br /&gt;
&lt;br /&gt;
• It can be any identifier except true or false. This includes C# keywords and identifiers declared in your C# code—both of which are fine.&lt;br /&gt;
&lt;br /&gt;
• It has no value. Unlike in C and C++, it does not represent a string.&lt;br /&gt;
&lt;br /&gt;
• The #define directive declares a compilation symbol.&lt;br /&gt;
&lt;br /&gt;
• The #undef directive undefines a compilation symbol.&lt;br /&gt;
&lt;br /&gt;
The #define and #undef directives can be used only at the top of a source file, before any C# code is listed. After the C# code has started, the #define and #undef directives can no longer be used.&lt;br /&gt;
&lt;br /&gt;
The scope of a compilation symbol is limited to a single source file. Redefining a symbol that is already defined is&lt;a name='more'&gt;&lt;/a&gt;perfectly fine—as long as it’s before any C# code, of course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;em&gt;Conditional Compilation&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Conditional compilation allows you to mark a section of source code to be either compiled or skipped, depending on whether a particular compilation symbol is defined.&lt;br /&gt;
&lt;br /&gt;
There are four directives for specifying conditional compilation:&lt;br /&gt;
&lt;br /&gt;
• #if&lt;br /&gt;
&lt;br /&gt;
• #else&lt;br /&gt;
&lt;br /&gt;
• #elif&lt;br /&gt;
&lt;br /&gt;
• #endif&lt;br /&gt;
&lt;br /&gt;
A condition is a simple expression that returns either true or false.&lt;br /&gt;
&lt;br /&gt;
• A condition can consist of a single compilation symbol or an expression of symbols and operators, as summarized below Subexpressions can be grouped with parentheses.&lt;br /&gt;
&lt;br /&gt;
• The literals true and false can also be used in conditional expressions.&lt;br /&gt;
&lt;br /&gt;
Parameter Type: Compilation symbol&lt;br /&gt;
Meaning: Identifier, defined (or not) using the #define directive &lt;br /&gt;
Evaluation: True: If the symbol has been defined using a #define directive False: Otherwise&lt;br /&gt;
&lt;br /&gt;
Parameter Type: Expression&lt;br /&gt;
Meaning: Constructed using symbols and the operators !, ==, !=, &amp;amp;&amp;amp;, &lt;br /&gt;
Evaluation: True: If the expression evaluates to true False: Otherwise&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;em&gt;The Conditional Compilation Constructs&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The #if and #endif directives are the matching demarcations of a conditional compilation construct. Whenever there is an #if directive, there must also be a matching #endif. Figure below illustrates the #if and #if...#else constructs.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-8I030HqJRu8/TYfdVVBTEjI/AAAAAAAAADg/3Di8akM8jgE/s1600/blog_img1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="112" r6="true" src="https://lh4.googleusercontent.com/-8I030HqJRu8/TYfdVVBTEjI/AAAAAAAAADg/3Di8akM8jgE/s320/blog_img1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;• If the condition in the #if construct evaluates to true, the code section following it is compiled. Otherwise, it is skipped.&lt;br /&gt;
&lt;br /&gt;
• In the #if...#else construct, if the condition evaluates to true, CodeSection1 is compiled. Otherwise, CodeSection2 is compiled.&lt;br /&gt;
&lt;br /&gt;
• In the #if...#elif construct, if Cond1 evaluates to true, CodeSection1 is compiled, and compilation continues after the #endif.&lt;br /&gt;
&lt;br /&gt;
— Otherwise, if Cond2 evaluates to true, CodeSection2 is compiled, and compilation continues after the #endif.&lt;br /&gt;
&lt;br /&gt;
— This continues until either a condition evaluates to true or all the conditions have returned false. If that’s the case, none of the code sections in the construct are compiled, and compilation continues after the #endif.&lt;br /&gt;
&lt;br /&gt;
• The #if...#elif...#else construct works the same way, except that if no condition is true, then&lt;br /&gt;
&lt;br /&gt;
the code section after the #else is then compiled, and compilation continues after the #endif.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh3.googleusercontent.com/-4_Ry0vFrrMU/TYfdZKQ__uI/AAAAAAAAADk/j8v_WT37448/s1600/blog_img2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="141" r6="true" src="https://lh3.googleusercontent.com/-4_Ry0vFrrMU/TYfdZKQ__uI/AAAAAAAAADk/j8v_WT37448/s320/blog_img2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;em&gt;Diagnostic Directives&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Diagnostic directives produce user-defined compile-time warning and error messages.&lt;br /&gt;
&lt;br /&gt;
The following is the syntax of the diagnostic directives. The messages are strings, but you will notice that unlike normal C# strings, they do not have to be enclosed in quotation marks.&lt;br /&gt;
&lt;br /&gt;
#warning Message&lt;br /&gt;
&lt;br /&gt;
#error Message&lt;br /&gt;
&lt;br /&gt;
When the compiler reaches a diagnostic directive, it writes out the associated message. The diagnostic directive messages are listed by the compiler along with any compiler-generated warning and error messages.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;em&gt;Line Number Directives&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Line number directives can do several things, including the following:&lt;br /&gt;
&lt;br /&gt;
• Change the apparent line numbers reported by the compiler’s warning and error messages&lt;br /&gt;
&lt;br /&gt;
• Change the apparent file name of the source file being compiled&lt;br /&gt;
&lt;br /&gt;
• Hide a sequence of lines from the interactive debugger&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;em&gt;Region Directives&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The region directive allows you to mark, and optionally name, a section of code. The characteristics of the #region directive are the following:&lt;br /&gt;
&lt;br /&gt;
• It is placed on the line above the section of code you want to mark.&lt;br /&gt;
&lt;br /&gt;
• It can take an optional string of text following it on the line, which serves as its name.&lt;br /&gt;
&lt;br /&gt;
• It must be terminated by an #endregion directive, further down in the code.&lt;br /&gt;
&lt;br /&gt;
Although region directives are ignored by the compiler, they can be used by source code tools.&lt;br /&gt;
&lt;br /&gt;
Visual Studio, for example, allows you to easily hide or display regions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;em&gt;The #pragma warning Directive&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The #pragma warning directive allows you to turn off warning messages and to turn them back on.&lt;br /&gt;
&lt;br /&gt;
• To turn off warning messages, use the disable form with a comma-separated list of warning numbers you want to turn off.&lt;br /&gt;
&lt;br /&gt;
• To turn warning messages back on, use the restore form with a list of the warning numbers you want to turn back on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is considered very important strategy to consider adding directives in your code, it will take the compilation time into the next level and will enhance your code.&lt;br /&gt;
&lt;br /&gt;
Future examples will be posted to demonstrate the practical usage of directives&lt;br /&gt;
&lt;br /&gt;
Stay tuned... Developers&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-7943515602906956874?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TEd82dbvssPMTbAPP-uAvjI_3vk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TEd82dbvssPMTbAPP-uAvjI_3vk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TEd82dbvssPMTbAPP-uAvjI_3vk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TEd82dbvssPMTbAPP-uAvjI_3vk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/Uced349wtnk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/7943515602906956874/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/03/preprocessor-directives-c-40.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/7943515602906956874?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/7943515602906956874?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/Uced349wtnk/preprocessor-directives-c-40.html" title="Preprocessor Directives C# 4.0" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh4.googleusercontent.com/-8I030HqJRu8/TYfdVVBTEjI/AAAAAAAAADg/3Di8akM8jgE/s72-c/blog_img1.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/03/preprocessor-directives-c-40.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4DQn0yeSp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-4451506653712267919</id><published>2011-03-14T23:50:00.002+02:00</published><updated>2011-04-15T23:06:13.391+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:06:13.391+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Subversion" /><category scheme="http://www.blogger.com/atom/ns#" term="Source Control System" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="Assembla" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Free Dot Net Source Control System For Group Development</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;&lt;br /&gt;
I guess many of the dot net developers are working in groups inside a company or within the same district and need to sync their files and work on the same project source without having to take it from a machine to another.&lt;br /&gt;
&lt;br /&gt;
Also Individual developers, who are working from their homes using desktops and laptops, want a way to synchronize their work without using any external drive for file transfer.&lt;br /&gt;
&lt;br /&gt;
The first way that everyone knows is the &lt;a href="http://www.dynamsoft.com/Products/SourceAnywhere-SourceSafe-VSS.aspx"&gt;Visual Source Safe&lt;/a&gt; or the most famous &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/team-foundation-server"&gt;Team Foundation Server&lt;/a&gt;, the VSS uses the file system to store the data while the TFS uses a database and both are supported. These two source control systems are used within an intranet (between computers in the same LAN) and both are costly.&lt;br /&gt;
&lt;br /&gt;
Small group of developers can not afford such product or don’t want to use it and still have the need for code redistribution.&lt;br /&gt;
&lt;br /&gt;
The solution is a free online repository (SVN), this type of source control is well known inside the Java community but not spread inside the Microsoft community.&lt;br /&gt;
&lt;br /&gt;
Let’s dive deep inside the “How to integrate SVN into &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/team-foundation-server"&gt;Visual Studio&lt;/a&gt; (our famous tool)”&lt;br /&gt;
&lt;br /&gt;
First you need to install the SVN plug-in for visual studio, I have chosen the free &lt;a href="http://ankhsvn.open.collab.net/"&gt;AnkhSvn&lt;/a&gt;, you can download it and install it for free into your visual studio.&lt;br /&gt;
&lt;br /&gt;
After the installation finishes, reopen your visual studio you will see the subversion-&amp;gt; open from Subversion option from the file menu as shown below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-jP59yPkz7I8/TX6LIWJtYUI/AAAAAAAAADQ/c556Gophfa8/s1600/svn1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="283" q6="true" src="https://lh5.googleusercontent.com/-jP59yPkz7I8/TX6LIWJtYUI/AAAAAAAAADQ/c556Gophfa8/s400/svn1.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now, it is the time to create the repository to connect to, one of the free online repository and a safe one is the &lt;a href="http://www.assembla.com/"&gt;Assembla&lt;/a&gt;. You can find another with a simple search keyword “Free svn repository”.&lt;br /&gt;
&lt;br /&gt;
Create a new account or use your already existing Google account to have your own repository.&lt;br /&gt;
&lt;br /&gt;
After creating your space your folder is ready and you have your repository URL (check the figure below)&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-wTuzsXKYK98/TX6LLpxM5oI/AAAAAAAAADU/prLCW6UEsI0/s1600/svn2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="166" q6="true" src="https://lh5.googleusercontent.com/-wTuzsXKYK98/TX6LLpxM5oI/AAAAAAAAADU/prLCW6UEsI0/s400/svn2.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will notice that a trunk folder is already created, this is a Java tradition&amp;nbsp;:) you need just to add your project inside it, and here you go.&lt;br /&gt;
&lt;br /&gt;
Now you are online and you can sync and submit your files anywhere with just an internet connection and some clicks. Open your solution or create new one and submit it easily&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-PcEFyMKDp5g/TX6LOoq44JI/AAAAAAAAADY/gWWy8zVSUY0/s1600/svn3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="245" q6="true" src="https://lh5.googleusercontent.com/-PcEFyMKDp5g/TX6LOoq44JI/AAAAAAAAADY/gWWy8zVSUY0/s400/svn3.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;em&gt;One of the good options in the SVN is the “ChangeLists” where you can revert files with a specific revision or submit date. (Figure below)&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-8-c27tq9cRo/TX6LROwfFkI/AAAAAAAAADc/GROMF4nVkBU/s1600/svn4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="343" q6="true" src="https://lh6.googleusercontent.com/-8-c27tq9cRo/TX6LROwfFkI/AAAAAAAAADc/GROMF4nVkBU/s400/svn4.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can check what are the actions on subversion and what is SVN (original one) check &lt;a href="http://en.wikipedia.org/wiki/Apache_Subversion"&gt;Subversion&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Now you have your project hosted on the cloud, you can add files, checkout files and/ or submit files into it, you can even backup your database and add it on the repository, or just upload the sql script to it.&lt;br /&gt;
&lt;br /&gt;
Try it; it is fascinating and so easy to assemble…&lt;br /&gt;
&lt;br /&gt;
Have a nice software day.&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-4451506653712267919?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/S1t5QpoUgJbuIAox-QaKpnr7Z-I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/S1t5QpoUgJbuIAox-QaKpnr7Z-I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/S1t5QpoUgJbuIAox-QaKpnr7Z-I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/S1t5QpoUgJbuIAox-QaKpnr7Z-I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/yXxwAODGkz0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/4451506653712267919/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/03/free-dot-net-source-control-system-for.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4451506653712267919?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4451506653712267919?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/yXxwAODGkz0/free-dot-net-source-control-system-for.html" title="Free Dot Net Source Control System For Group Development" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh5.googleusercontent.com/-jP59yPkz7I8/TX6LIWJtYUI/AAAAAAAAADQ/c556Gophfa8/s72-c/svn1.JPG" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/03/free-dot-net-source-control-system-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQBRX0yeyp7ImA9WhZQFU0.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-1400353630222371461</id><published>2011-03-10T01:49:00.004+02:00</published><updated>2011-04-23T00:05:54.393+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-23T00:05:54.393+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ADAM" /><category scheme="http://www.blogger.com/atom/ns#" term="AD" /><category scheme="http://www.blogger.com/atom/ns#" term="LDAP" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="Active Directory Membership Provider" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Active Directory Membership Provider</title><content type="html">&lt;div dir="ltr" style="text-align: justify;" trbidi="on"&gt;I have noticed that most of the developers are eager to learn about active directory connection and membership for ASP.net, I have provided an old post about the subject but I noticed it was attractive to many users who needed more info. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"&gt;Working with Active Directory&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Out of the box, there is a reasonably high likelihood that you can get the provider to start working with an AD domain. Because the first hurdle you will face is the question of connectivity to the directory, getting the correct connection string is important. Luckily, if you know what your options are it is alsopretty easy to setup. For starters, you can configure a sample application with the provider that attempts to retrieve a user object from the Users container that is found on all domains. Because ActiveDirectoryMembershipProvider is not configured in either machine.config or the root web.config files, you will need to explicitly configure it in web.config.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;membership defaultprovider="appprovider"&amp;gt;&lt;br /&gt;
&amp;lt;providers&amp;gt;&lt;br /&gt;
&amp;lt;clear/&amp;gt;&lt;br /&gt;
&amp;lt;add&amp;nbsp;name="appprovider"&amp;nbsp;type="System.Web.Security.ActiveDirectoryMembershipProvider, ..."&amp;nbsp;connectionStringName="DirectoryConnection"&amp;gt;&lt;br /&gt;
&amp;lt;/providers&amp;gt;&lt;br /&gt;
&amp;lt;/membership&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because none of the other provider-specific configuration options are used, the provider will connect to the directory using the underlying process credentials. This is an important point because it means that, by default, when running on IIS6 the provider will connect to your directory as NETWORK SERVICE (that is, the machine account from the perspective of the directory server). For now, let’s use a connection string that looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;connectionstrings&amp;gt;&amp;nbsp;&amp;lt;add&amp;nbsp;connectionstring="LDAP://myADServer.com" name="DirectoryConnection"&amp;gt;&lt;br /&gt;
&amp;lt;/connectionstrings&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This style of connection string tells the provider to explicitly connect to a specific directory server. Note, though, that there is no other information in the connection string, which means that the provider will automatically attempt to bind to the Users container. To see whether this configuration works, a simple test page writes out some of the properties of a user that already exists in the directory:&lt;br /&gt;
&lt;br /&gt;
MembershipUser mu = Membership.GetUser(“user@myADServer.com”);&lt;br /&gt;
Response.Write("Email address is: " + mu.Email + "");&lt;br /&gt;
Response.Write("Creation date is: " + mu.CreationDate.ToString() + "");&lt;br /&gt;
When I ran this sample app against a directory server, the following information was returned:&lt;br /&gt;
Email address is: user@myADServer.com&lt;br /&gt;
Creation date is: 3/6/2005 1:12:57 PM&lt;br /&gt;
&lt;br /&gt;
This isn’t exactly earth-shattering information, but if you think about it, with only some standard configuration entries and some boilerplate Membership code, you are now accessing a user object in a directory.&lt;br /&gt;
&lt;br /&gt;
No need for kung-fu coding with classes in the System.DirectoryServices namespace let alone mucking around with the older ADSI programming APIs.&lt;br /&gt;
&lt;br /&gt;
You can make things more interesting by first trying different variations of the connection string. One variation simply points the application at the domain, as opposed to a domain controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;add&amp;nbsp;connectionstring="LDAP://myADServer.com"&lt;br /&gt;
name="DirectoryConnection"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice how the connection string no longer points at a specific server. Now the provider is simply leveraging the default connectivity behavior supported by AD where you can just supply the DNS name associated with the domain and the underlying network stack performs the magic of looking up special directory service entries in DNS to route the request to an actual domain controller. Although this type of connection string is interesting to know about, and it can be useful in a development environment just to get things up and running, in an extranet environment you need to be careful with this type of connection string. Because you aren’t guaranteed a connection to any specific directory controller, you can end up in cases where an operation against a user object occurs against one domain controller, and then at a later point in time the provider connects to a different controller that has not yet received the replicated changes. This behavior is not a bad thing; you just need to be aware of whether your application can tolerate this. The nice thing about a serverless connection string is that your application isn’t tied to the uptime of any specific directory server. Instead, the provider will connect to whatever is available, and if a DC goes down then the provider will simply be routed to a different server.&lt;br /&gt;
&lt;br /&gt;
Another connection string variation (and probably the most common one you will use) includes the container name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;add&amp;nbsp;name="DirectoryConnection"&lt;br /&gt;
&lt;br /&gt;
connectionString="LDAP://myAdServer.com/CN=Users,DC=myAdServer,&lt;br /&gt;
DC=com"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this connection string, the provider will bind to the container specified after the server name. In this case, the connection string is binding to the Users container. If you have ever used ADSI or System. DirectoryServices, this should be a familiar syntax to you for binding to the Users container.&lt;br /&gt;
&lt;br /&gt;
If you use the provider in an extranet environment where different user populations are segmented into different organizational units (that is, OUs), then you would use a connection string like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;add&amp;nbsp;name="DirectoryConnection"&lt;br /&gt;
connectionString="LDAP://myAdServer.com/OU=UserPopulation_A,DC=myAdServer,&lt;br /&gt;
DC=com"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now instead of referencing a built in container, the connection string references an OU that was created in the domain. In this case, the OU is a peer of the Users container. However, you can just as easily bind to OUs that are nested any number of levels deep.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;add&amp;nbsp;name="DirectoryConnection"&lt;br /&gt;
connectionString="LDAP://myAdServer.com/OU=SomeNestedOU,OU=UserPopulation_A,DC=myAdServer,&lt;br /&gt;
DC=com"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For nested containers, you just build up the second part of the connection string with the walk-up path from the nested OU to the top of the container hierarchy.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"&gt;Active Directory Schema Mappings&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
By default the provider attempts to map the properties of the MembershipUser class to an appropriate set of default attributes on the user class in AD and ADAM. Some aspects of this mapping are configurable, whereas other aspects are not. The most important constraint is that ActiveDirectoryMembershipProvider always binds to objects of type user. Although in Windows Server 2003 and ADAM the ability to use inetOrgPerson was added, the provider currently only supports binding to objects of type user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following properties on MembershipUser have fixed schema mappings to attributes in the directory:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;ProviderUserKey&lt;/b&gt;: This value maps to the objectSID attribute on the user object. As a result, you can get the user’s security identifier (SID) from the ProviderUserKey property and you can also retrieve MembershipUser instances using the SID as a key.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Comment&lt;/b&gt;: Maps to the comment attribute on the user class.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;CreationDate&lt;/b&gt;: Maps to the whenCreated attribute on the user class.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;LastPasswordChangedDate&lt;/b&gt;—Maps to the pwdLastSet attribute on the user class.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;IsApproved&lt;/b&gt;: Maps to the userAccountControl attribute when using AD. Maps to the mDSUserAccountDisabled attribute when using ADAM.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;IsLockedOut&lt;/b&gt;: Maps to msDS-User-Account-Control-Computed attribute when using AD on Windows Server 2003 or when using ADAM. This property is computed from the lockoutTime attribute and the directory’s account lockout duration setting when running against Windows 2000 AD (W2K’s schema did not include the msDS-User-Account-Control-Computed attribute). If you have configured the provider to support question-and-answer-based password reset, then the provider will also look at the custom tracking information for bad password answers when determining whether a user is considered locked out.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;LastLockoutDate&lt;/b&gt;: Maps to the lockoutTime attribute on the user class. If question-andanswer-based password reset has been enabled, then the lockout date may also come from the custom attributes that track bad password answer attempts.&lt;br /&gt;
&lt;br /&gt;
Other properties on MembershipUser are either not mapped by default or have default mappings to directory attributes that you can change.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Username—By default&lt;/b&gt;, the provider maps this property to the userPrincipalName attribute in the directory. This mapping will work for you if each of your directory users is created with a user principal name. For older directories, though, you may be using the NT4-style SAM account names, in which case you will need to change the mapping for this property. You can change the mapping to the sAMAccountName attribute in this case. Note that if you try to use the provider with an already populated directory, and you are scratching your head wondering why you can’t find any users or successfully validate any credentials, it is probably because your users have SAM account names, but you have not configured the provider to use the SAMAccountName attribute for MembershipUser.Username.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Email—By default&lt;/b&gt;, the provider maps this property to the mail attribute. If you want, you can change this mapping to any single-valued attribute on the user class that is of type Unicode String.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PasswordQuestion&lt;/b&gt;: This property is not mapped by default to anything in the directory. If you intend to use question-and-answer-based password resets with the provider, there are actually five different attributes that need to be mapped on the user class. The section on “Working with Active Directory” walks you through adding custom attributes to the AD schema and setting up password reset functionality.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because Active Directory operates in a multimaster environment, some of the properties on MembershipUser cannot be reliably implemented based on directory attributes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;LastActivityDate&lt;/b&gt;: This property has no mapping and is not supported by the provider.&lt;br /&gt;
&lt;br /&gt;
There is no concept in either AD or ADAM of touching the user object every time something happens. Unlike the SQL providers where different features all update a LastActivityDate column in the database, attempting to engineer a similar approach for AD wasn’t feasible. First, there would be no way for other features such as Profile to reach into a user object in a directory and update an arbitrary field (suddenly you would have System.DirectoryServices code sitting in the middle of the SQL provider code, which would be a bit strange to say the least).&lt;br /&gt;
&lt;br /&gt;
Another problem is that for this value to make any sense in a multimaster environment you would have to replicate the field to all of the various domain controllers. Because it isn’t likely that most customers would want to add a custom attribute and then replicate it across their domain infrastructure each and every time the attribute was changed, the decision was made not to support the concept of a last activity date for the provider.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;LastLoginDate&lt;/b&gt;: Both AD and ADAM store the last logon time for a user using the lastLogon and lastLogonTimestamp attributes, respectively. However, these attributes aren’t replicated across domain controllers, and the property is not available from the global catalog.&lt;br /&gt;
&lt;br /&gt;
So, it is very likely that the provider would either get differing values for this property or stale property values in any domain that had at least two domain controllers. Rather than having the provider iterate through all domain controllers in a domain attempting to find the latest value the decision was made to not implement this property.&lt;br /&gt;
&lt;br /&gt;
If you want to change any of the configurable attribute mappings for the provider, you can do so by using the following configuration attributes in the provider’s &lt;add&gt;element:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attributeMapUserName&lt;/b&gt;: You can use this provider configuration attribute to change which attribute on the user class the provider uses for identifying a user. You can set this to either userPrincipalName (the default) or to sAMAccountName.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attributeMapEmail&lt;/b&gt;: If you don’t want to store user’s email addresses in the default mail attribute, you can tell the provider to use a different directory attribute instead. The only restriction is that that the directory attribute must be of type Unicode String.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attributeMapPasswordQuestion&lt;/b&gt;: This configuration attribute must be defined for the provider if you set enablePasswordReset to true. The configuration attribute must reference a directory attribute of type Unicode String.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attributeMapPasswordAnswer&lt;/b&gt; This configuration attribute must be defined for the provider if you set enablePasswordReset to true. The configuration attribute must reference a directory attribute of type Unicode String.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attributeMapFailedPasswordAnswerCount&lt;/b&gt;: This configuration attribute must be defined for the provider if you set enablePasswordReset to true. The configuration attribute must reference a directory attribute of type Integer.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attributeMapFailedPasswordAnswerTime&lt;/b&gt;: This configuration attribute must be defined for the provider if you set enablePasswordReset to true. The configuration attribute must reference a directory attribute of type Large Integer/Interval.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;attributeMapFailedPasswordAnswerLockoutTime&lt;/b&gt;: This configuration attribute must be defined for the provider if you set enablePasswordReset to true. The configuration attribute must reference a directory attribute of type Large Integer/Interval.&lt;br /&gt;
&lt;br /&gt;
Along with the directory schema mappings comes a set of default size restrictions on the length of various string properties. With the SQL provider, it is pretty easy to determine length restrictions by just looking in the database at the column definitions. For the AD provider, this is harder to accomplish unless you can look at the actual directory schema. The default length restrictions for various MembershipUser-related properties are shown in the following list. Note though that it is possible for you to edit the AD and ADAM schemas to enforce even shorter size restrictions. If you have done this, the provider will honor the size restrictions defined in your directory’s schema.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Username&lt;/b&gt;: If you mapped username to sAMAccountName then your username cannot be longer than 20 characters. This is a hard-coded size restriction from NT4 days. If you mapped username to userPrincipalName, then a username cannot be longer than 64 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Password&lt;/b&gt;: As with the SQL provider, the plaintext password for a user cannot be longer than 128 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Comment&lt;/b&gt;: The provider only allows comments up to 1024 characters in length. This differs from the SQL provider, where you could basically store the entire English dictionary if you wanted in a user’s Comment property.&lt;br /&gt;
&lt;br /&gt;
Email—A user’s email property cannot be longer than 256 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PasswordQuestion&lt;/b&gt;: A user’s password question cannot be longer than 256 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PasswordAnswer&lt;/b&gt;: A user’s cleartext password answer cannot be longer than 128 characters.&lt;br /&gt;
&lt;br /&gt;
However, the end result of encrypting the password answer also cannot be longer than 128 characters.&lt;br /&gt;
&lt;br /&gt;
Because the ActiveDirectoryMembershipProvider always encrypts the password answer&lt;br /&gt;
&lt;br /&gt;
using the same encryption method for SqlMembershipProvider, this limits users to around a 42-character long cleartext password answer.&lt;br /&gt;
&lt;br /&gt;
Hope I have addressed useful information about Active Directory, wait more post to come&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-1400353630222371461?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wLuVhHHd5ZqqGaUD9NvxUhGwDxw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wLuVhHHd5ZqqGaUD9NvxUhGwDxw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wLuVhHHd5ZqqGaUD9NvxUhGwDxw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wLuVhHHd5ZqqGaUD9NvxUhGwDxw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/J0JZrFQFKUo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/1400353630222371461/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/03/active-directory-membership-provider.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/1400353630222371461?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/1400353630222371461?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/J0JZrFQFKUo/active-directory-membership-provider.html" title="Active Directory Membership Provider" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/03/active-directory-membership-provider.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQDR3Y4cCp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-2225619450331507494</id><published>2011-03-08T23:55:00.002+02:00</published><updated>2011-04-15T23:12:56.838+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:12:56.838+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Soft Skills" /><category scheme="http://www.blogger.com/atom/ns#" term="Leadership" /><category scheme="http://www.blogger.com/atom/ns#" term="Project management" /><category scheme="http://www.blogger.com/atom/ns#" term="Teamwork" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="Communication" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Software Skills (The Art of Software Development)</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Simply put, soft skills are the ability to communicate with people. They are the skills that make customers feel happy. They are the skills that keep customers, make individuals valuable. So, if you’re wondering what the incentive is to brush up on this skill set—its money, baby!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To a technical person, anything outside of product and development skills could be considered soft skills, but here’s an unofficial list of soft skills for technical people and why they’re important. These are as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Project management&lt;/strong&gt;:&lt;br /&gt;
Project management goes beyond learning Microsoft Project or any other software. Success as a project manager depends on your ability to define, plan, organize, control, and complete a variety of complex and interdependent tasks.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Communication:&lt;/b&gt;&lt;br /&gt;
Whether answering the phone, writing an e-mail, or putting together a proposal, how well you put your point across affects others’ perceptions of your abilities. Make sure each interaction paints an intelligent picture.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Presentation:&lt;/b&gt;&lt;br /&gt;
Forget the horror of high school oral-communications classes. These skills are a must for any situation—from running a meeting to pitching a product or solution, or justifying why you should get that raise. It doesn’t matter how many are in the audience; every time you open your mouth, you are using these skills. Make sure you’re presenting the image you want by mastering this skill set.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Selling:&lt;/b&gt;&lt;br /&gt;
Face it; regardless of whether your title includes “sales,” you’re always selling. Whether it’s yourself, your project, or your next position, you’re always asking people to buy in on something. Learn how to do it more effectively and do it eagerly.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Running meetings: &lt;/b&gt;&lt;br /&gt;
Learning how to facilitate meetings and manage group interactions is an important first step to becoming a team leader.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Leadership:&lt;/b&gt;&lt;br /&gt;
Successful projects have many keys, including organizational buy-in, good project management, and proper resourcing. A strong leader understands these dynamics, harnesses the diverse energies within an organization, and pulls everyone together. It’s about knowing your resources and key points. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Problem-solving:&lt;/b&gt;&lt;br /&gt;
This is the skill you are probably most familiar with. To some, problem solving comes instinctively. To others, it’s not so natural. The key is to find a process that works and apply it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Customer service:&lt;/b&gt;&lt;br /&gt;
Yes, people are difficult. But, when they’re customers, they come first and they’re always right. They need to feel valued and important. Just remember: if you don’t treat them right, someone else will. This is your main target to get a value.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Self-direction:&lt;/b&gt;&lt;br /&gt;
This is the ability to do your job without having to be told how to do your job. It’s extremely important, because by the time your manager gets through telling you how to do it, he/she could have probably done it himself/herself.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Teamwork:&lt;/b&gt;&lt;br /&gt;
No man is an island, certainly not in IT where there isn’t room for egos. With so many different operating systems (OSs), servers, networks, databases, and other things that need to be coordinated, no one can do it alone. Here’s where those skills you learned in kindergarten come in: sharing, saying “please,” and—more importantly—saying “thank you.” Play nicely with others or take a time-out.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unfortunately, as any five-year-old can tell you, knowing how to share isn’t the same as doing it. You can’t learn soft skills unless you practice them. And this top-ten list is worth more than a few quick laughs—it can be your ticket to a highly successful IT career. Take a look at your current situation and see how you’ve managed to put these skills into practice.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-family: Eureka-Roman; font-size: 10.5pt;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;i&gt;&lt;b&gt;This topic will be followed by similar posts later, all of which will be addressing how to improve and maintain your soft skills. Nothing comes without effort.&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-2225619450331507494?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XsWeV5QoAEjabl4vVbs_kC3t35o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XsWeV5QoAEjabl4vVbs_kC3t35o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XsWeV5QoAEjabl4vVbs_kC3t35o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XsWeV5QoAEjabl4vVbs_kC3t35o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/qvmWh9tFwpg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/2225619450331507494/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/03/software-skills-art-of-software.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/2225619450331507494?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/2225619450331507494?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/qvmWh9tFwpg/software-skills-art-of-software.html" title="Software Skills (The Art of Software Development)" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/03/software-skills-art-of-software.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMDRnc-eCp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-5378837548325014798</id><published>2011-03-04T11:55:00.003+02:00</published><updated>2011-04-15T23:14:37.950+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:14:37.950+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVP Pattern" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>The MVP Pattern</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;MVP is a derivative of MVC aimed at providing a cleaner separation between the view, the model, and the controller. The most relevant change from MVC is that view and model are physically separated and have no intimate knowledge of each other. The controller (renamed as presenter) is a mediator between the user and the application. Solicited by the view, it performs any work associated with the request and passes data back to the view. In MVP, the controller class is essentially responsible for presenting data to the view, which explains the new name of “presenter.”&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Generalities of the MVP Pattern&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;As mentioned, in MVP the view and the model are neatly separated, and the view exposes a contract through which the presenter can read input values and provide results of the action.&lt;br /&gt;
Summarizing the situation further, we can say that MVP is a refinement of MVC based on three facts:&lt;br /&gt;
■ The view doesn’t know the model.&lt;br /&gt;
&lt;br /&gt;
■ The presenter ignores any UI technology behind the view.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;■ Abstracted to an interface, the view is easy to mock up, which makes testing the controller far easier.&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;a href="https://lh4.googleusercontent.com/-y07PCBJrKaE/TXCyOZn6QyI/AAAAAAAAACw/yBkBPk6nyMw/s1600/MVP1.JPG" imageanchor="1" style="height: 195px; margin-left: 1em; margin-right: 1em; width: 383px;"&gt;&lt;img border="0" height="197" l6="true" src="https://lh4.googleusercontent.com/-y07PCBJrKaE/TXCyOZn6QyI/AAAAAAAAACw/yBkBPk6nyMw/s400/MVP1.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;The presenter is at the center of the universe and incorporates the presentation logic behind the view. The presenter in MVP is logically bound to the view, which is another reason for emphasizing the presentation role of the component. &lt;a href="http://aspnetmvp.codeplex.com/"&gt;ASP.Net MVP Framework&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;em&gt;Comparison of MVC and MVP graphically&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;a href="https://lh5.googleusercontent.com/-EaRBtvU2Z1E/TXCyQ7y9E7I/AAAAAAAAAC0/SHROkL9pCmM/s1600/MVP2.JPG" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="173" l6="true" src="https://lh5.googleusercontent.com/-EaRBtvU2Z1E/TXCyQ7y9E7I/AAAAAAAAAC0/SHROkL9pCmM/s400/MVP2.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;strong&gt;Role of the Model&lt;/strong&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;The best possible definition of the model doesn’t change in MVP. The model is the representation&lt;/div&gt;of the data being worked on in the view. The above figure exposes a contracted interface, which represents the core functionality of the view to the presenter’s eyes. In other words, the presenter should be able to work with any object that implements that contracted interface.&lt;br /&gt;
In theory, it could be an ASP.NET page as well as a Windows Forms window. The model in MVP, therefore, is the interface that the view object implements. Being an interface, it can include properties, but it can also include methods and events. In a Web Forms scenario, events are not required, and most of the time it will contain just properties.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Role of the View&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The view is the Web Forms page that you build. This view is typically an instance of a class that inherits from Page or UserControl and implements the model. The view also holds a reference to an instance of the presenter. Between views and presenters, you typically have a one-to-one cardinality, even though you can still reduce the number of presenter classes by creating some sort of hierarchy and reusing a bit of code.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Role of the Presenter&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The presenter is just an additional layer you build on top of code-behind classes. It is a class that can be easily designed to have no hidden dependencies. The presenter requires a reference on the view, but thanks to the contracted interface of the view the reference can be injected. The presenter will use the view object to grab input values and prepare a call to the middle tier. After the response has been received, the presenter will pass data back to the view, always through the members of the interface. As mentioned, the interface that abstracts the view is logically equivalent to the model in MVC. you can check it at MSDN at &lt;a href="http://msdn.microsoft.com/en-us/library/ff647543.aspx"&gt;Model-View-Presenter Pattern&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Web Forms and the MVP Pattern&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
MVP lends itself very well to being implemented in Web Forms. The pattern can be easily outlined as a step-by-step procedure and doesn’t require you to twist the Web Forms programming model. As a developer, you only need to add a bit of abstraction to your Web Forms pages to gain the benefits of the MVP pattern—testability and maintainability.&lt;br /&gt;
&lt;br /&gt;
Having said that, I also feel obliged to mention that MVP is not a pattern for everyone and for just any application. MVP provides guidance on how to manage heaps of views and, quite obviously, comes at a cost—the cost of increased complexity in the application code. As you can imagine, these costs are easier to absorb in large applications than in simple ones. MVP, therefore, is not just for any application.&lt;br /&gt;
&lt;br /&gt;
In MVP, the view is defined through an interface, and this interface is the only point of contact between the system and the view. As an architect, after you’ve abstracted a view with an interface, you can give developers the green light to start developing presentation logic without waiting for designers to produce the graphics. After developers have interfaces, they can start coding and interfaces can be extracted from user stories, if not from full specifications.&lt;br /&gt;
&lt;br /&gt;
MVP is an important presentation pattern that can be a bit expensive to implement in relatively simple applications. On the other hand, MVP shines in enterprise-class applications, where you really need to reuse as much presentation logic as possible, across multiple platforms and in Software-as-a-Service (SaaS) scenarios. And many of these applications have an ASP.NET Web Forms front end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img height="47" src="https://lh4.googleusercontent.com/-y07PCBJrKaE/TXCyOZn6QyI/AAAAAAAAACw/yBkBPk6nyMw/s320/MVP1.JPG" style="filter: alpha(opacity=30); left: 231px; mozopacity: 0.3; opacity: 0.3; position: absolute; top: 495px; visibility: hidden;" width="96" /&gt;Another full article about MVP is introduced at MSDN&amp;nbsp;Magzine &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc188690.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/cc188690.aspx&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-5378837548325014798?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/srN_BQWtB63Z5i8oPvbO3clBQpM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/srN_BQWtB63Z5i8oPvbO3clBQpM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/srN_BQWtB63Z5i8oPvbO3clBQpM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/srN_BQWtB63Z5i8oPvbO3clBQpM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/SSP0pEi-P7g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/5378837548325014798/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/03/mvp-pattern.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/5378837548325014798?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/5378837548325014798?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/SSP0pEi-P7g/mvp-pattern.html" title="The MVP Pattern" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh4.googleusercontent.com/-y07PCBJrKaE/TXCyOZn6QyI/AAAAAAAAACw/yBkBPk6nyMw/s72-c/MVP1.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/03/mvp-pattern.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIBRn05cCp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-4872010324842385045</id><published>2011-02-26T01:01:00.001+02:00</published><updated>2011-04-15T23:15:57.328+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:15:57.328+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Custom Paging" /><category scheme="http://www.blogger.com/atom/ns#" term="GridView" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Custom Paging GridView (Inheriting from the Base GridView Control)</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Developers, you are trying to implement custom paging for ASP.net GridView and sure you have read many posts and information about this subject.&lt;br /&gt;
&lt;br /&gt;
Many posts used this by applying external pagers outside the GridView. this is over :) lets use iheritance to implement that:&lt;br /&gt;
&lt;br /&gt;
Create the extension class &lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;CustomPagingGridView &lt;span style="color: black; font-family: Times New Roman; font-size: small;"&gt;that inherits &lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;GridView &lt;span style="color: black; font-family: Times New Roman; font-size: small;"&gt;as follows:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: black; font-family: Times New Roman; font-size: small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: black; font-family: Times New Roman; font-size: small;"&gt;public class &lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;CustomPagingGridView &lt;/span&gt;: &lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;GridView &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
public CustomPagingGridView()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : base()&lt;br /&gt;
{&lt;br /&gt;
this.AllowPaging = true;&lt;br /&gt;
this.AllowSorting = true;&lt;br /&gt;
this.PagerSettings.Mode = PagerButtons.NumericFirstLast;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#region Custom properties&lt;br /&gt;
&lt;br /&gt;
[Browsable(true), Category("Updated")]&lt;br /&gt;
[Description("Set the Database table total item count for this grid")]&lt;br /&gt;
public int TotalDatabaseItemCount&lt;br /&gt;
{&lt;br /&gt;
get&lt;br /&gt;
{&lt;br /&gt;
if (ViewState["pgv_vitemcount"] == null)&lt;br /&gt;
ViewState["pgv_vitemcount"] = -1;&lt;br /&gt;
return Convert.ToInt32(ViewState["pgv_vitemcount"]);&lt;br /&gt;
}&lt;br /&gt;
set&lt;br /&gt;
{&lt;br /&gt;
ViewState["pgv_vitemcount"] = value;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
[Browsable(true), Category("Updated")]&lt;br /&gt;
[Description("Get the item ordering when sorting event is triggered")]&lt;br /&gt;
public string OrderBy&lt;br /&gt;
{&lt;br /&gt;
get&lt;br /&gt;
{&lt;br /&gt;
if (ViewState["pgv_orderby"] == null)&lt;br /&gt;
ViewState["pgv_orderby"] = string.Empty;&lt;br /&gt;
return ViewState["pgv_orderby"].ToString();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
protected set&lt;br /&gt;
{&lt;br /&gt;
ViewState["pgv_orderby"] = value;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private int CurrentPageIndex&lt;br /&gt;
{&lt;br /&gt;
get&lt;br /&gt;
{&lt;br /&gt;
if (ViewState["pgv_pageindex"] == null)&lt;br /&gt;
ViewState["pgv_pageindex"] = 0;&lt;br /&gt;
return Convert.ToInt32(ViewState["pgv_pageindex"]);&lt;br /&gt;
}&lt;br /&gt;
set&lt;br /&gt;
{&lt;br /&gt;
ViewState["pgv_pageindex"] = value;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private bool CustomPaging&lt;br /&gt;
{&lt;br /&gt;
get&lt;br /&gt;
{&lt;br /&gt;
return (TotalDatabaseItemCount != -1);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
#endregion&lt;br /&gt;
&lt;br /&gt;
#region Overriding the parent methods&lt;br /&gt;
&lt;br /&gt;
public override object DataSource&lt;br /&gt;
{&lt;br /&gt;
get&lt;br /&gt;
{&lt;br /&gt;
return base.DataSource;&lt;br /&gt;
}&lt;br /&gt;
set&lt;br /&gt;
{&lt;br /&gt;
base.DataSource = value;&lt;br /&gt;
CurrentPageIndex = PageIndex;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
protected override void OnSorting(GridViewSortEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
SortDirection direction = SortDirection.Ascending;&lt;br /&gt;
if (ViewState[e.SortExpression] != null &amp;amp;&amp;amp; (SortDirection)ViewState[e.SortExpression] == SortDirection.Ascending)&lt;br /&gt;
{&lt;br /&gt;
direction = SortDirection.Descending;&lt;br /&gt;
}&lt;br /&gt;
ViewState[e.SortExpression] = direction;&lt;br /&gt;
OrderBy = string.Format("{0} {1}", e.SortExpression, (direction == SortDirection.Descending ? "DESC" : ""));&lt;br /&gt;
base.OnSorting(e);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
protected override void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)&lt;br /&gt;
{&lt;br /&gt;
if (CustomPaging)&lt;br /&gt;
{&lt;br /&gt;
pagedDataSource.AllowCustomPaging = true;&lt;br /&gt;
pagedDataSource.VirtualCount = TotalDatabaseItemCount;&lt;br /&gt;
pagedDataSource.CurrentPageIndex = CurrentPageIndex;&lt;br /&gt;
}&lt;br /&gt;
base.InitializePager(row, columnSpan, pagedDataSource);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#endregion&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: black; font-family: Times New Roman; font-size: small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: x-small;"&gt;&lt;span style="color: black; font-family: Times New Roman; font-size: small;"&gt;When you include this class within your code and compile, a "CustomPagingGridView" will be added in the toolbar under the pointer icon while opening any aspx file&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add it to your design view and set its properties as desired.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Properties:&lt;br /&gt;
&lt;br /&gt;
when clicking on the newly added custom gridview in the properties part, a new section named "Updated" is added containing two properties that can be programmatically set, these properties are "TotalDatabaseItemCount" and "OrderBy" &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The total database item count is the total number to be fetched for example if you want to fetch 1000 item from database 10 by 10 (1000 is the count to be fetched ex “select Count(*) from table1")&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next you have to set the TotalDatabaseItemCount=1000 and get records from database 10 by 10 using inline stored procedure or inner query “select * from table1 where rownum&amp;gt;10 &amp;amp;&amp;amp; rownum&amp;lt;20” this will fetch the first bulk.&lt;br /&gt;
&lt;br /&gt;
In the previous example we are getting the second page of the gridview if we has a pager of 10, note that the number can be populated from the current index and page number.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hope this will be useful. Feel free to ask any question or inquire about any example.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-4872010324842385045?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Niu7xdp8ymVc8mSeYK919In1pgc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Niu7xdp8ymVc8mSeYK919In1pgc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Niu7xdp8ymVc8mSeYK919In1pgc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Niu7xdp8ymVc8mSeYK919In1pgc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/SfAfB60dozc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/4872010324842385045/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/02/custom-paging-gridview-inheriting-from.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4872010324842385045?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4872010324842385045?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/SfAfB60dozc/custom-paging-gridview-inheriting-from.html" title="Custom Paging GridView (Inheriting from the Base GridView Control)" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/02/custom-paging-gridview-inheriting-from.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEMHQHY8fSp7ImA9WhZXEE8.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-95746963361752520</id><published>2011-02-21T23:35:00.006+02:00</published><updated>2011-04-29T00:33:51.875+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-29T00:33:51.875+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="LINQ" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>DOT NET 4.0 LINQ to Services (LINQ to Amazon, google, bing, JSON, LDAP (Active Directory), Streams, DryadLINQ …)</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;THE HIDDEN PART OF LINQ -you will discover an amazing abilities of LINQ-&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;LINQ to Services&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
In the real world, many widely used services already have LINQ implementations. Most of these implementations are community based and are not officially supported by single-service providers.&lt;br /&gt;
One of the first LINQ wrappers to an external service was &lt;a target='_blank' href="http://linqinaction.net/blogs/main/archive/2007/12/12/linq-in-action-samples-source-code.aspx" linkindex="76"&gt;LINQ to Amazon&lt;/a&gt;. Using this service,you can look for books in the Amazon catalog, filtering them by attributes such as publisher,price, title,and so on. Similarly, by using LINQ to Flickr (http://linqflickr.codeplex.com), you can search for photos stored in the Flickr photo-sharing service. LINQ to Flickr also offers support for adding or deleting photos, a feature not directly tied to the LINQ query syntax, but which is conceptually similar to the entities you can manage in LINQ to SQL or LINQ to Entities.&lt;br /&gt;
&lt;br /&gt;
Google is another source for accessing data through remote services. The &lt;a target='_blank' href="http://glinq.codeplex.com/" linkindex="77"&gt;LINQ to Google&lt;/a&gt; implementation actually supports only queries to Google Base, which is a search engine that can index structured entities decorated with customizable attributes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The presence of these attributes makes the use of LINQ meaningful, because you can include them as part of a LINQ query, as shown in the following example:&lt;br /&gt;
GoogleItems.GoogleContext gc = new GoogleItems.GoogleContext(key);&lt;br /&gt;
var r = from car in gc.products&lt;br /&gt;
where car.Brand == “car” &amp;amp;&amp;amp; car.Price &amp;lt; 5400&lt;br /&gt;
select new { car.Title, car.Price };&lt;br /&gt;
&lt;br /&gt;
The Bing search engine offers a LINQ to Bing provider, which is part of the Web Application &lt;a target='_blank' href="http://code.msdn.microsoft.com/webapptoolkitbing" linkindex="78"&gt;Toolkit for Bing Search&lt;/a&gt;. This provider supports searches on webpages, news, images, and video. Here is an example of a Bing web&lt;br /&gt;
&lt;br /&gt;
query:&lt;br /&gt;
Linq2Bing lb = new Linq2Bing();&lt;br /&gt;
var query = from w in lb.Web&lt;br /&gt;
where w.Text == “test” &amp;amp;&amp;amp; w.Text == “test1”&lt;br /&gt;
select w;&lt;br /&gt;
&lt;br /&gt;
Yet another LINQ implementation that could be useful for accessing remote services is LINQ to JSON, which is included in Microsoft Silverlight and accessible through the System.Json namespace. Another implementation you can use without Silverlight is the &lt;a target='_blank' href="http://json.codeplex.com/" linkindex="79"&gt;Json.NET 3.5 library&lt;/a&gt;. This implementation provides a LINQ-integrated model that simplifies access from a .NET Framework application to data serialized with JSON.&lt;br /&gt;
&lt;br /&gt;
Simplifying access to remote services that provide integration with LINQ queries is an area that will likely see great expansion in the future. The service provider does not need to define its own LINQ wrapper; any service consumer can write a LINQ wrapper for that service. However,the most widely used services will probably be supported either directly by service providers or by projects that are supported by communities.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;LINQ for System Engineers&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&amp;nbsp;&lt;/u&gt;&lt;/b&gt;Applications that control an existing infrastructure or that automate administrative tasks might be able to take advantage of LINQ while accessing specific services and APIs useful for their needs.&lt;br /&gt;
&lt;br /&gt;
&lt;a target='_blank' href="http://linqtoad.codeplex.com/" linkindex="80"&gt;LINQ to Active Directory&lt;/a&gt; is an implementation that simplifies access to Active Directory APIs, such as System.DirectoryServices (.NET) and ActiveDs (COM).&lt;br /&gt;
&lt;br /&gt;
The same author originally wrote (and analytically described) a more general implementation of &lt;a target='_blank' href="http://www.hookedonlinq.com/LINQ2LDAP.ashx" linkindex="81"&gt;LINQ to LDAP&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Another interesting LINQ implementation is one that provides access to Windows Management Instrumentation (WMI). check implementation&amp;nbsp;of&amp;nbsp;&lt;a  target='_blank' href="http://linq2wmi.codeplex.com/" linkindex="82"&gt;LINQ to WMI&lt;/a&gt; . By using a provider like this, you can query WMI counters in a simple and declarative way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Dynamic LINQ&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
The standard result of a LINQ query is considered to be static. It does not change after query execution. However, there are situations in which the definition of a LINQ query should be more dynamic, acting more as a filter in a stream of data or making the query result “live.”&lt;br /&gt;
&lt;br /&gt;
The &lt;a target='_blank' href="http://slinq.codeplex.com/" linkindex="83"&gt;LINQ to Streams implementation&lt;/a&gt; focuses on streaming data those changes in real time. Currently, it is a simple prototype, but the approach seems interesting for particular scenarios such as network monitors, financial services, and real-time data acquisition.&lt;br /&gt;
&lt;br /&gt;
Another approach to the same issue is the one used in SyncLINQ. This implementation is focused more on data binding over LINQ queries. To support dynamic updates of the query result, a SyncLINQ query returns collections that implement INotifyCollectionChanged, which is the interface provided by the .NET Framework to notify listeners of dynamic changes. The SyncLINQ implementation should establish compatibility with existing user interface components that support INotifyCollectionChanged.&lt;br /&gt;
&lt;br /&gt;
These implementations do not provide a solution for every tier of an application’s architecture, but they do present an interesting approach to solving some of the issues regarding the use of a common programming pattern (LINQ queries). These implementations attempt to simplify and encapsulate the work necessary to handle dynamic updates to data returned from a query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Other LINQ Enhancements and Tools&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a target='_blank' href="http://research.microsoft.com/projects/DryadLINQ" linkindex="84"&gt;DryadLINQ&lt;/a&gt; is a research project that uses LINQ to access Dryad, a distributed execution engine. DryadLINQ compiles lambda expressions into DLLs and routes the DLLs to remote machines for execution. This is a more complex form of parallelism than the one offered by PLINQ and is an interesting implementation for very CPU-intensive applications.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a target='_blank' href="http://i4o.codeplex.com/" linkindex="85"&gt;Indexed LINQ&lt;/a&gt;, also known as I4O, is a class library through which you can create indexes on objects queried using LINQ to Objects. This implementation is particularly interesting for applications that load and maintain a large number of objects in memory. Using optimizations like the one provided by I4O, any object graph in memory can seem like an in-memory database, even if LINQ and I40 do not automatically solve the issues of concurrent access in a multithreaded environment.&lt;br /&gt;
&lt;br /&gt;
&lt;a target='_blank' href="http://linqextender.codeplex.com/" linkindex="86"&gt;LINQExtender&lt;/a&gt; is a tool for building LINQ providers. The LINQ to Flickr provider mentioned earlier was created using this tool. The tool is particularly interesting because it provides an extensible model that supports an object-tracking service similar to the one that exists in LINQ to SQL. Another feature of LINQExtender is that it does not require you to extend a parser for an expression tree. The existing parser converts an expression tree into a simpler object that describes the query itself. This simplification might not be good for every application, but you will probably encounter many cases in which a simple provider cannot support complex queries just because the service that it wraps has very simple and limited query semantics.&lt;br /&gt;
&lt;br /&gt;
MetaLinq, also called &lt;a target='_blank' href="http://metalinq.codeplex.com/" linkindex="87"&gt;LINQ to Expressions&lt;/a&gt;, is a library that allows manipulation of a LINQ query. This library offers an object model through which you can manipulate an expression tree (which could be a query tree) without the limitations imposed by a real expression tree, which is made of immutable objects. The final stage of this manipulation is the creation of an equivalent immutable expression tree that can be used with LINQ.&lt;br /&gt;
&lt;br /&gt;
A useful tool for writing and testing LINQ queries is &lt;a target='_blank' href="http://www.linqpad.net/" linkindex="88"&gt;LINQPad&lt;/a&gt;, which is both an interactive editor and an execution environment for LINQ and SQL queries. It supports queries written using LINQ to SQL, LINQ to Objects, and LINQ to XML.&lt;br /&gt;
&lt;br /&gt;
Another interesting tool is &lt;a target='_blank' href="http://linqovercsharp.codeplex.com/" linkindex="89"&gt;LINQ over C#&lt;/a&gt; , which provides a parser for Microsoft Visual C# that can be used together with LINQ as a solid base for refactoring code and creating software quality assurance (QA) tools.&lt;br /&gt;
&lt;br /&gt;
Finally, &lt;a target='_blank' href="http://linqtogeo.codeplex.com/" linkindex="90"&gt;LINQ to Geo&lt;/a&gt;&amp;nbsp;is a LINQ implementation for querying geospatial data, and LINQ to Lucene (http://linqtolucene.codeplex.com) supports the Lucene Information Retrieval System, which is a free open-source search engine.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-95746963361752520?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RC3kTc9iW8x2m2bkmzQy31_Rln8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RC3kTc9iW8x2m2bkmzQy31_Rln8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RC3kTc9iW8x2m2bkmzQy31_Rln8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RC3kTc9iW8x2m2bkmzQy31_Rln8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/qxKRQPHU3pw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/95746963361752520/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/02/dot-net-40-linq-to-services-linq-to.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/95746963361752520?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/95746963361752520?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/qxKRQPHU3pw/dot-net-40-linq-to-services-linq-to.html" title="DOT NET 4.0 LINQ to Services (LINQ to Amazon, google, bing, JSON, LDAP (Active Directory), Streams, DryadLINQ …)" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/02/dot-net-40-linq-to-services-linq-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkADQHc4cCp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-4784223385344477190</id><published>2011-02-20T23:10:00.001+02:00</published><updated>2011-04-15T23:19:31.938+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:19:31.938+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Parallell Computing" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Parallelism" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Dot Net 4.0 Parallel Computing</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
&lt;strong&gt;Data Parallelism&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Achieving parallel computing exploits the capability to process large data sets by partitioning them into chunks, each of which gets processed in parallel. Such techniques have existed for a long time in database query processor engines but apply equally well in the context of a general-purpose programming language. This is where TPL’s data parallelism comes in, which can be found in the System.Threading.Tasks.Parallel class.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Parallel For Loops&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
One first form of data parallelism is exposed by the Parallel.For set of methods, which provide a parallel for loop. The idea of a parallel for loop is to run the iterations of the loop in parallel, followed by a wait operation for all the iterations to complete.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Simple Overloads&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The simplest of overloads to For take in three parameters: an inclusive lower bound, an exclusive upper bound, and a delegate representing the loop body. Two families of For loop methods exist, one based on Int32 (C# int) values and another based on Int64 (C# long) values:&lt;br /&gt;
static ParallelLoopResult For(int fromInclusive, int toExclusive,Action&lt;int&gt; body);&lt;br /&gt;
static ParallelLoopResult For(long fromInclusive, long toExclusive,Action&lt;long&gt; body);&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Using ParallelLoopState&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
A second group of overloads just extends the loop body delegate with an additional parameter of type ParallelLoopState:&lt;br /&gt;
static ParallelLoopResult For(int fromInclusive, int toExclusive,Action&lt;int, parallelloopstate=""&gt; body);&lt;br /&gt;
static ParallelLoopResult For(long fromInclusive, long toExclusive,Action&lt;long, parallelloopstate=""&gt; body);&lt;br /&gt;
The use case for a ParallelLoopState is to break prematurely from the loop in a variety of ways.&lt;br /&gt;
By calling Break, the Parallel.For code ceases to spawn new tasks for the iterations beyond the current point there the break was requested. For example, if Function1 evaluates true in iteration 10, the call to Break will cause no iterations beyond the 10th to get scheduled. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Use of ParallelOptions&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Other overloads to Parallel.For take in a ParallelOptions object, which can configure up to three settings:&lt;br /&gt;
public class ParallelOptions&lt;br /&gt;
{&lt;br /&gt;
public CancellationToken CancellationToken { get; set; }&lt;br /&gt;
public int MaxDegreeOfParallelism { get; set; }&lt;br /&gt;
public TaskScheduler TaskScheduler { get; set; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The first one allows the specification of a cancellation token that can be used to cancel the loop from executing further, causing an OperationCanceledException to be thrown from the Parallel.For code.&lt;br /&gt;
&lt;br /&gt;
Using the &lt;em&gt;MaxDegreeOfParallelism &lt;/em&gt;property, the number of parallel workers used to process the loop iterations can be limited. You should exercise caution when using this flag because you might be needlessly reducing the scalability of your application, especially if you use magic constant values here. This flag can be used when you happen to know about competing resources and want to divide parallel resources in one way or another. Typically, such calculations depend on the number of cores, which can be obtained through the System.Environment class.&lt;br /&gt;
&lt;br /&gt;
Finally, the TaskScheduler property can be used to pass in your own scheduler. The MSDN documentation shows how to implement such a beast if you really have to&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Parallel Foreach Loops&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Just as the Parallel.For method resembles a C# for loop, the Parallel.ForEach method is designed to mirror the C# foreach loop. Given an enumerable sequence, the ForEach method allows for the parallel execution of a loop body for each of the elements in the given sequence.&lt;br /&gt;
&lt;br /&gt;
Most of the concepts discussed in our coverage of For carry over to the ForEach case as well, including the use of ParallelLoopOptions, the ParallelLoopState with Break and Stop methods, and the &lt;em&gt;ParallelLoopResult.&lt;/em&gt; Similarly, thread-local state can be associated with the workers that carry out the loop’s work.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;The Role of Partitioners&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
To run operations on the elements of a sequence in parallel, the sequence needs to be partitioned into chunks of work. This is where the concept of partitioners enters the picture. They play a crucial role in the PLINQ implementation.&lt;br /&gt;
&lt;br /&gt;
The idea of a partitioner is to let the workers that execute the loop body process more than just individual elements one at a time. For example, if you have 100 elements and four cores, it makes sense to have each core take care of the work for 25 elements. Such a common partitioning scheme is called range partitioning, where the input sequence size has to be known upfront to create index-based ranges for each worker. This scheme has a disadvantage, though: If one worker completes way before other workers are done with their part of the work, the idle worker cannot steal work.&lt;br /&gt;
&lt;br /&gt;
Another way to partition a sequence is chunk partitioning, where chunks of a given size are processed by workers. This differs from range partitioning in that the split-up of the work is not statically based on the number of workers. For example, given 100 elements and a chunk size of 5, we get 20 units of work. If there are, say, four cores with a worker allocated for each core, they will on average execute five chunks each. This isn’t static allocation of chunks to workers, though; if a worker is presented with a chunk, it can process much faster than another worker can process its chunk, and it can readily move on to the next chunk. Overall, the throughput of the system is higher. Load-balancing partitioning is another name for the use of dynamic chunk-based partitioning.&lt;br /&gt;
&lt;br /&gt;
You can create a partitioner by using the Partitioner.Create factory methods. A set of overloads is based on from and to bounds, combined with range sizes, creating a partitioner that employs range partitioning. Other overloads can take in an array or an IList&lt;t&gt; object, whose length is known immediately. Depending on a Boolean flag named loadBalance, the resulting partitioner uses range partitioning or load-balancing chunk partitioning.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-4784223385344477190?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pI_4GxuFik49EdE3bUW92hSvgTw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pI_4GxuFik49EdE3bUW92hSvgTw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pI_4GxuFik49EdE3bUW92hSvgTw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pI_4GxuFik49EdE3bUW92hSvgTw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/A5vUzTZw2eQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/4784223385344477190/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2011/02/dot-net-40-parallel-computing.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4784223385344477190?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4784223385344477190?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/A5vUzTZw2eQ/dot-net-40-parallel-computing.html" title="Dot Net 4.0 Parallel Computing" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2011/02/dot-net-40-parallel-computing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8CQnk8eSp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-4419067658815433722</id><published>2009-07-10T11:22:00.004+03:00</published><updated>2011-04-15T23:21:03.771+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:21:03.771+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Windows Forms" /><category scheme="http://www.blogger.com/atom/ns#" term="Visual Inheritance" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Visual Inheritance In Windows Applications</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
As in web application, the concept of Master page was done for implementing some kind of visual inheritance from a page where all child pages have the same look and feel, this is more shown and implemented using Windows application.&lt;br /&gt;
&lt;br /&gt;
Let’s take an example:&lt;br /&gt;
Add new project (windows forms application) and a new page and name it for example "Base". put some sort of background image or modify any property for this page (setting the maximize box to false), save and build you application then add new item named inherited form and chose the base form you have already added, and here we go the new page will have the same layout as the base page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Power of inheritance:&lt;br /&gt;
more than this we can use the power of inheritance by defining methods and properties in the main form (Base) that can be override in any child form, let’s consider for example the reset form method that is used to reset all text boxes or dropdown lists or any control say for example the following code:&lt;br /&gt;
public virtual void ResetForm ()   &lt;br /&gt;
{       &lt;br /&gt;
foreach (Control item in this.Controls)   &lt;br /&gt;
{         &lt;br /&gt;
if (item.GetType().Name == "TextBox")      &lt;br /&gt;
{                    item.Text = string.Empty;                }  &lt;br /&gt;
}   &lt;br /&gt;
}&lt;br /&gt;
this is set in the base form and is called in all pages that inherit this form without even defining it and of course it can be overridden&lt;br /&gt;
&lt;br /&gt;
same concept for controls like buttons you can defing you own button that inherits from button control then add some style or even implement some sort of event handling  for example:&lt;br /&gt;
public class MyButton:System.Windows.Forms.Button   &lt;br /&gt;
{   &lt;br /&gt;
protected override void OnMouseHover(EventArgs e)&lt;br /&gt;
{      &lt;br /&gt;
base.OnMouseHover(e);    &lt;br /&gt;
//change style or do any sort of visual interaction &lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
then all you have to do just drag and drop it into your form and here you have the same button in all your forms and you can do any change on it , it will be reflected every where.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-4419067658815433722?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/c4NJZsqRRSci6NeOCOQ3kKXMxz4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c4NJZsqRRSci6NeOCOQ3kKXMxz4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/c4NJZsqRRSci6NeOCOQ3kKXMxz4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c4NJZsqRRSci6NeOCOQ3kKXMxz4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/wtkw62C3ijc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/4419067658815433722/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2009/07/visual-inheritance-as-in-web.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4419067658815433722?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/4419067658815433722?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/wtkw62C3ijc/visual-inheritance-as-in-web.html" title="Visual Inheritance In Windows Applications" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2009/07/visual-inheritance-as-in-web.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcFR3g6eCp7ImA9WhZXGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-9144409184528576860</id><published>2008-10-21T09:37:00.004+03:00</published><updated>2011-05-09T01:00:16.610+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-09T01:00:16.610+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><title>Design Patterns Applicability</title><content type="html">&lt;b&gt;Creational Patterns&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Abstract factory (Kit)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Abstract Factory pattern when&lt;br /&gt;
&lt;br /&gt;
o    A system should be independent of how its products are created, composed, and represented.&lt;br /&gt;
&lt;br /&gt;
o    A system should be configured with one of multiple families of products.&lt;br /&gt;
&lt;br /&gt;
o    A family of related product objects is designed to be used together, and you need to enforce this constraint.&lt;br /&gt;
&lt;br /&gt;
o    You want to provide a class library of products, and you want to reveal just their interfaces, not their implementations.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Builder&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Builder pattern when&lt;br /&gt;
&lt;br /&gt;
o    The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled.&lt;br /&gt;
&lt;br /&gt;
o     The construction process must allow different representations for the object that's constructed.&lt;br /&gt;
&lt;br /&gt;
Factory Method (virtual constructor)&lt;br /&gt;
&lt;br /&gt;
Use the Factory Method pattern when&lt;br /&gt;
&lt;br /&gt;
o    A class can't anticipate the class of objects it must create.&lt;br /&gt;
o    A class wants its subclasses to specify the objects it creates.&lt;br /&gt;
o    Classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Prototype&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Prototype pattern when&lt;br /&gt;
&lt;br /&gt;
o     a system should be independent of how its products are created, composed, and represented; &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;and&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
o    when the classes to instantiate are specified at run-time, for example, by dynamic loading; &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;or&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
o    to avoid building a class hierarchy of factories that parallels the class hierarchy of products; or&lt;br /&gt;
&lt;br /&gt;
o    When instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually, each time with the appropriate state.&lt;br /&gt;
&lt;br /&gt;
Singleton&lt;br /&gt;
&lt;br /&gt;
Use the Singleton pattern when&lt;br /&gt;
&lt;br /&gt;
o   There must be exactly one instance of a class, and it must be accessible to clients from a well-known access point.&lt;br /&gt;
o    When the sole instance should be extensible by sub classing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Structural Patterns&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Adapter (Wrapper)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Adapter pattern when&lt;br /&gt;
&lt;br /&gt;
o   You want to use an existing class, and its interface does not match the one you need.&lt;br /&gt;
&lt;br /&gt;
o   You want to create a reusable class that cooperates with unrelated or unforeseen classes, that is, classes that don't necessarily have compatible interfaces.&lt;br /&gt;
&lt;br /&gt;
o    (Object adapter only) you need to use several existing subclasses, but it's impractical to adapt their interface by subclassing every one. An object adapter can adapt the interface of its parent class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Bridge (Handle/Body)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Bridge pattern when&lt;br /&gt;
&lt;br /&gt;
o    You want to avoid a permanent binding between an abstraction and its implementation. This might be the case, for example, when the implementation must be selected or switched at run-time.&lt;br /&gt;
&lt;br /&gt;
o    Both the abstractions and their implementations should be extensible by subclassing. In this case, the Bridge pattern lets you combine the different abstractions and implementations and extend them independently.&lt;br /&gt;
&lt;br /&gt;
o    Changes in the implementation of an abstraction should have no impact on clients; that is, their code should not have to be recompiled.&lt;br /&gt;
&lt;br /&gt;
o    (C++) you want to hide the implementation of an abstraction completely from clients. In C++ the representation of a class is visible in the class interface.&lt;br /&gt;
&lt;br /&gt;
o    You have a proliferation of classes as shown earlier in the first Motivation diagram. Such a class hierarchy indicates the need for splitting an object into two parts. Rumbaugh uses the term "nested generalizations"&lt;br /&gt;
&lt;br /&gt;
o    To refer to such class hierarchies.&lt;br /&gt;
&lt;br /&gt;
o   You want to share an implementation among multiple objects (perhaps using reference counting), and this fact should be hidden from the client.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Composite&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Composite pattern when&lt;br /&gt;
&lt;br /&gt;
o   you want to represent part-whole hierarchies of objects.&lt;br /&gt;
&lt;br /&gt;
o    you want clients to be able to ignore the difference between compositions of objects and individual objects. Clients will treat all objects in the composite structure uniformly.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Decorator (Wrapper)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Use Decorator&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
o   To add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects.&lt;br /&gt;
&lt;br /&gt;
o   For responsibilities that can be withdrawn.&lt;br /&gt;
&lt;br /&gt;
o   When extension by subclassing is impractical. Sometimes a large number of independent extensions are&lt;br /&gt;
&lt;br /&gt;
o   Possible and would produce an explosion of subclasses to support every combination. Or a class definition&lt;br /&gt;
&lt;br /&gt;
o    May be hidden or otherwise unavailable for subclassing.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Façade&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Facade pattern when&lt;br /&gt;
&lt;br /&gt;
o    You want to provide a simple interface to a complex subsystem. Subsystems often get more complex as they&lt;br /&gt;
&lt;br /&gt;
o    Evolve. Most patterns, when applied, result in more and smaller classes. This makes the subsystem more&lt;br /&gt;
&lt;br /&gt;
o    Reusable and easier to customize, but it also becomes harder to use for clients that don't need to customize it. A&lt;br /&gt;
&lt;br /&gt;
o    Facade can provide a simple default view of the subsystem that is good enough for most clients. Only clients&lt;br /&gt;
&lt;br /&gt;
o    Needing more customizability will need to look beyond the facade.&lt;br /&gt;
&lt;br /&gt;
o    There are many dependencies between clients and the implementation classes of an abstraction. Introduce a&lt;br /&gt;
&lt;br /&gt;
o    facade to decouple the subsystem from clients and other subsystems, thereby promoting subsystem independence and portability.&lt;br /&gt;
&lt;br /&gt;
o    You want to layer your subsystems. Use a facade to define an entry point to each subsystem level. If subsystems are dependent, then you can simplify the dependencies between  them by making them Communicate with each other solely through their facades.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;FlyWeight&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The Flyweight pattern's effectiveness depends heavily on how and where it's used. Apply the Flyweight pattern when all of the following are true:&lt;br /&gt;
&lt;br /&gt;
o   An application uses a large number of objects.&lt;br /&gt;
&lt;br /&gt;
o   Storage costs are high because of the sheer quantity of objects.&lt;br /&gt;
&lt;br /&gt;
o   Most object state can be made extrinsic.&lt;br /&gt;
&lt;br /&gt;
o   Many groups of objects may be replaced by relatively few shared objects once extrinsic state is removed.&lt;br /&gt;
&lt;br /&gt;
o    The application doesn't depend on object identity. Since flyweight objects may be shared, identity tests will return true for conceptually distinct objects.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Proxy (Surrogate)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Proxy is applicable whenever there is a need for a more versatile or sophisticated reference to an object than a simple pointer. Here are several common situations in which the Proxy pattern is applicable:&lt;br /&gt;
&lt;br /&gt;
o   A remote proxy provides a local representative for an object in a different address space. Coplien calls this kind of proxy an "Ambassador."&lt;br /&gt;
&lt;br /&gt;
o   A virtual proxy creates expensive objects on demand.&lt;br /&gt;
&lt;br /&gt;
o   A protection proxy controls access to the original object. Protection proxies are useful when objects should have different access rights. For example, KernelProxies in the Choices operating system provide protected access to operating system objects.&lt;br /&gt;
&lt;br /&gt;
o   A smart reference is a replacement for a bare pointer that performs additional actions when an object is accessed. Typical uses include counting the number of references to the real object so that it can be freed automatically when there are no more references (also called smart pointers).&lt;br /&gt;
&lt;br /&gt;
o   Loading a persistent object into memory when it's first referenced.&lt;br /&gt;
&lt;br /&gt;
o    Checking that the real object is locked before it's accessed to ensure that no other object can change it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Behavioral Patterns&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Chain of responsibility&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use Chain of Responsibility when&lt;br /&gt;
&lt;br /&gt;
o   More than one object may handle a request, and the handler isn't known a priori. The handler should be ascertained automatically.&lt;br /&gt;
&lt;br /&gt;
o    You want to issue a request to one of several objects without specifying the receiver explicitly the set of objects that can handle a request should be specified dynamically.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Command  (Action, Transaction)&lt;/b&gt;&lt;br /&gt;
Use the Command pattern when&lt;br /&gt;
&lt;br /&gt;
o   You want to parameterize objects by an action to perform, as MenuItem objects did above. You can express such parameterization in a procedural language with a callback function, that is, a function that's registered somewhere to be called at a later point. Commands are an object-oriented replacement for callbacks.&lt;br /&gt;
&lt;br /&gt;
o   Specify, queue, and execute requests at different times. A Command object can have a lifetime independent of the original request. If the receiver of a request can be represented in an address  spaceindependent way, then you can transfer a command object for the request to a different process and fulfill the request there.&lt;br /&gt;
&lt;br /&gt;
o   Support undo. The Command's Execute operation can store state for reversing its effects in the command itself. The Command interface must have an added Unexecute operation that reverses the effects of a previous call to Execute. Executed commands are stored in a history list. Unlimited-level undo and redo is achieved by traversing this list backwards and forwards calling Unexecute and Execute, respectively.&lt;br /&gt;
&lt;br /&gt;
o   Support logging changes so that they can be reapplied in case of a system crash. By augmenting the Command interface with load and store operations, you can keep a persistent log of changes.&lt;br /&gt;
&lt;br /&gt;
o   Recovering from a crash involves reloading logged commands from disk and reexecuting them with the Execute operation.&lt;br /&gt;
&lt;br /&gt;
o    Structure a system around high-level operations built on primitives operations. Such a structure is common in information systems that support transactions. A transaction encapsulates a set of changes to data. The Command pattern offers a way to model transactions. Commands have a common interface, letting you invoke all transactions the same way. The pattern also makes it easy to extend the system with new transactions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Interpreter&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Interpreter pattern when there is a language to interpret, and you can represent statements in the language as abstract syntax trees. The Interpreter pattern works best when&lt;br /&gt;
&lt;br /&gt;
o   The grammar is simple. For complex grammars, the class hierarchy for the grammar becomes large and unmanageable. Tools such as parser generators are a better alternative in such cases.&lt;br /&gt;
&lt;br /&gt;
o   They can interpret expressions without building abstract syntax trees, which can save space and possibly time.&lt;br /&gt;
&lt;br /&gt;
o    Efficiency is not a critical concern. The most efficient interpreters are usually not implemented by interpreting parse trees directly but by first translating them into another form. For example, regular expressions are often transformed into state machines. But even then, the translator can be implemented by the Interpreter pattern, so the pattern is still applicable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Iterator (Cursor)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Iterator pattern&lt;br /&gt;
&lt;br /&gt;
o   To access an aggregate object's contents without exposing its internal representation.&lt;br /&gt;
&lt;br /&gt;
o   To support multiple traversals of aggregate objects.&lt;br /&gt;
&lt;br /&gt;
o    To provide a uniform interface for traversing different aggregate structures (that is, to support polymorphic iteration).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Mediator&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Mediator pattern when&lt;br /&gt;
&lt;br /&gt;
o   a set of objects communicate in well-defined but complex ways. The resulting interdependencies are unstructured and difficult to understand.&lt;br /&gt;
&lt;br /&gt;
o   reusing an object is difficult because it refers to and communicates with many other objects.&lt;br /&gt;
&lt;br /&gt;
o    a behavior that's distributed between several classes should be customizable without a lot of subclassing.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Memento (Token)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Memento pattern when&lt;br /&gt;
&lt;br /&gt;
o   A snapshot of (some portion of) an object's state must be saved so that it can be restored to that state later, and&lt;br /&gt;
&lt;br /&gt;
o    A direct interface to obtaining the state would expose implementation details and break the object's encapsulation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Observer  (Dependents, Publish-Subscribe)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Observer pattern in any of the following situations:&lt;br /&gt;
&lt;br /&gt;
o    When an abstraction has two aspects, one dependent on the other. Encapsulating these aspects in separate objects lets you vary and reuse them independently.&lt;br /&gt;
&lt;br /&gt;
o    When a change to one object requires changing others, and you don't know how many objects need to be changed.&lt;br /&gt;
&lt;br /&gt;
o    When an object should be able to notify other objects without making assumptions about who these objects are. In other words, you don't want these objects tightly coupled.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;State (Objects for States)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the State pattern in either of the following cases:&lt;br /&gt;
&lt;br /&gt;
o   An object's behavior depends on its state, and it must change its behavior at run-time depending on that state.&lt;br /&gt;
&lt;br /&gt;
o    Operations have large, multipart conditional statements that depend on the object's state. This state is usually represented by one or more enumerated constants. Often, several operations will contain this same conditional structure. The State pattern puts each branch of the conditional in a separate class. This lets you treat the object's state as an object in its own right that can vary independently from other objects.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Strategy (Policy)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Strategy pattern when&lt;br /&gt;
&lt;br /&gt;
o   Many related classes differ only in their behavior. Strategies provide a way to configure a class with one of many behaviors.&lt;br /&gt;
&lt;br /&gt;
o   You need different variants of an algorithm. For example, you might define algorithms reflecting different space/time trade-offs. Strategies can be used when these variants are implemented as a class hierarchy of algorithms&lt;br /&gt;
&lt;br /&gt;
o   An algorithm uses data that clients shouldn't know about. Use the Strategy pattern to avoid exposing complex, algorithm-specific data structures.&lt;br /&gt;
&lt;br /&gt;
o    A class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditionals, move related conditional branches into their own Strategy class.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Template Method&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The Template Method pattern should be used&lt;br /&gt;
&lt;br /&gt;
o   To implement the invariant parts of an algorithm once and leave it up to subclasses to implement the behavior that can vary.&lt;br /&gt;
&lt;br /&gt;
o   When common behavior among subclasses should be factored and localized in a common class to avoid code duplication. This is a good example of "refactoring to generalize" as described by Opdyke and Johnson. You first identify the differences in the existing code and then separate the differences into new operations. Finally, you replace the differing code with a template method that calls one of these new operations.&lt;br /&gt;
&lt;br /&gt;
o    To control subclasses extensions. You can define a template method that calls "hook" operations at specific points, thereby permitting extensions only at those points&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Visitor&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the Visitor pattern when&lt;br /&gt;
&lt;br /&gt;
o   An object structure contains many classes of objects with differing interfaces, and you want to perform operations on these objects that depend on their concrete classes.&lt;br /&gt;
&lt;br /&gt;
o   Many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them.&lt;br /&gt;
&lt;br /&gt;
o    The classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes.&lt;br /&gt;
&lt;br /&gt;
reference:&lt;br /&gt;
Design Patterns: Elements of Reusable Object-Oriented Software book&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-9144409184528576860?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DQ6WjDkgYSQv5GAZFPGnR-hQMjw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DQ6WjDkgYSQv5GAZFPGnR-hQMjw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DQ6WjDkgYSQv5GAZFPGnR-hQMjw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DQ6WjDkgYSQv5GAZFPGnR-hQMjw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/4golQ15fmv0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/9144409184528576860/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2008/10/design-patterns-applicability.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/9144409184528576860?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/9144409184528576860?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/4golQ15fmv0/design-patterns-applicability.html" title="Design Patterns Applicability" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://www.dsoftworld.com/2008/10/design-patterns-applicability.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4CQHs6fSp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-699156364235023059</id><published>2008-07-15T14:24:00.003+03:00</published><updated>2011-04-15T23:22:41.515+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:22:41.515+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Some Asp.net practices to share</title><content type="html">Greeting developers i have something to share.&lt;br /&gt;
while am developing i've discovered some sort of ways that is ment to be an asp.net good practices those methods are:&lt;br /&gt;
&lt;br /&gt;
1-Error handling :&lt;br /&gt;
i was fund of all those try catch in all my methods some times am even adding the same call of a method for loging the error and for redirecting to another page or even send email&lt;br /&gt;
&lt;br /&gt;
those were usual and many times i was geeting bored when i was writing the try catch after each new method i write .......&lt;br /&gt;
&lt;br /&gt;
one good prcatice i've found practical is the page error its result was amazing:&lt;br /&gt;
first ive created a my own custom page that inherits from system.web.ui.page then i have set all my aspx pages to inherits from this page&lt;br /&gt;
&lt;br /&gt;
next i've implemented the page_error method as follows&lt;br /&gt;
&lt;br /&gt;
Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error&lt;br /&gt;
'here we can handle page exception logs the errors and redirect&lt;br /&gt;
Dim objErr As Exception = Server.GetLastError().GetBaseException()&lt;br /&gt;
objErr = Nothing&lt;br /&gt;
'of cource u can add here send email or add to event log what ever u want&lt;br /&gt;
Me.Response.Redirect("ErrorPage.aspx")&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
and just was it every error generated on the page was logged and redirected to login although in some special cases where i want to handle the code with a different logic i was adding the usual try catch method...&lt;br /&gt;
&lt;br /&gt;
2-SqlDataBase interaction:&lt;br /&gt;
&lt;br /&gt;
for times and times we have worked with ado.net and all its fuctionality and at each class or even on each page we have write the same code defining our connection setting the connection string defining the command to excute nonquerry, scalar or table querry we used our adapter with its select and update commands , we have done the bulk update in the database and all other ado.net and database connection that we are all working with&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
it seemed non ending and it caused error tracing to be dificult also if u were using in each class the same command you will search where i forgot to invoke the parameter.clear and where the error occure .&lt;br /&gt;
&lt;br /&gt;
i have founded that separating all data access in a class or library would be usefull for example ive created this small class for this idea:&lt;br /&gt;
&lt;br /&gt;
Imports System.Data.SqlClient&lt;br /&gt;
Public Class DatabaseCommunication&lt;br /&gt;
#Region "Fields"&lt;br /&gt;
Private _con As SqlConnection&lt;br /&gt;
Private _cmd As SqlCommand&lt;br /&gt;
Private _adp As SqlDataAdapter&lt;br /&gt;
Private _connectionCounter As Integer&lt;br /&gt;
#End Region&lt;br /&gt;
&lt;br /&gt;
#Region "Methods"&lt;br /&gt;
Public Sub New(ByVal strConnection As String)&lt;br /&gt;
Me._con = New SqlConnection&lt;br /&gt;
Me._cmd = New SqlCommand&lt;br /&gt;
Me._adp = New SqlDataAdapter&lt;br /&gt;
Me._con.ConnectionString = strConnection&lt;br /&gt;
Me._connectionCounter = 0&lt;br /&gt;
End Sub&lt;br /&gt;
Private Sub OpenConnection()&lt;br /&gt;
If Me._connectionCounter = 0 AndAlso Me._con.State &lt;&gt; ConnectionState.Open Then Me._con.Open()&lt;br /&gt;
Me._connectionCounter += 1&lt;br /&gt;
End Sub&lt;br /&gt;
Private Sub CloseConnection()&lt;br /&gt;
Me._connectionCounter -= 1&lt;br /&gt;
If Me._connectionCounter = 0 AndAlso Me._con.State &lt;&gt; ConnectionState.Closed Then Me._con.Close()&lt;br /&gt;
End Sub&lt;br /&gt;
Public Sub ExecuteNonQuery(ByVal ProcedureName As String, ByVal ProcedureParameters As SqlParameter())&lt;br /&gt;
Try&lt;br /&gt;
Me._cmd.CommandType = CommandType.StoredProcedure&lt;br /&gt;
Me._cmd.CommandText = ProcedureName&lt;br /&gt;
If ProcedureParameters.Length &gt; 0 Then&lt;br /&gt;
For Each parm As SqlParameter In ProcedureParameters&lt;br /&gt;
Me._cmd.Parameters.Add(parm)&lt;br /&gt;
Next&lt;br /&gt;
End If&lt;br /&gt;
Me.OpenConnection()&lt;br /&gt;
Me._cmd.ExecuteNonQuery()&lt;br /&gt;
Catch ex As Exception&lt;br /&gt;
Throw ex&lt;br /&gt;
Finally&lt;br /&gt;
Me.CloseConnection()&lt;br /&gt;
Me._cmd.Parameters.Clear()&lt;br /&gt;
End Try&lt;br /&gt;
End Sub&lt;br /&gt;
Public Function ExecuteScalar(ByVal ProcedureName As String, ByVal ProcedureParameters As SqlParameter()) As Object&lt;br /&gt;
Try&lt;br /&gt;
Me._cmd.CommandType = CommandType.StoredProcedure&lt;br /&gt;
Me._cmd.CommandText = ProcedureName&lt;br /&gt;
If ProcedureParameters.Length &gt; 0 Then&lt;br /&gt;
For Each parm As SqlParameter In ProcedureParameters&lt;br /&gt;
Me._cmd.Parameters.Add(parm)&lt;br /&gt;
Next&lt;br /&gt;
End If&lt;br /&gt;
Me.OpenConnection()&lt;br /&gt;
Return Me._cmd.ExecuteScalar()&lt;br /&gt;
Catch ex As Exception&lt;br /&gt;
Throw ex&lt;br /&gt;
Finally&lt;br /&gt;
Me.CloseConnection()&lt;br /&gt;
Me._cmd.Parameters.Clear()&lt;br /&gt;
End Try&lt;br /&gt;
End Function&lt;br /&gt;
Public Function ExecuteQuery(ByVal ProcedureName As String, ByVal ProcedureParameters As SqlParameter()) As DataTable&lt;br /&gt;
Try&lt;br /&gt;
Dim dtt As New DataTable&lt;br /&gt;
Me._cmd.CommandType = CommandType.StoredProcedure&lt;br /&gt;
Me._cmd.CommandText = ProcedureName&lt;br /&gt;
If ProcedureParameters.Length &gt; 0 Then&lt;br /&gt;
For Each parm As SqlParameter In ProcedureParameters&lt;br /&gt;
Me._cmd.Parameters.Add(parm)&lt;br /&gt;
Next&lt;br /&gt;
End If&lt;br /&gt;
Me._adp.SelectCommand = Me._cmd&lt;br /&gt;
Me._adp.Fill(dtt)&lt;br /&gt;
Return dtt&lt;br /&gt;
Catch ex As Exception&lt;br /&gt;
Throw ex&lt;br /&gt;
Finally&lt;br /&gt;
Me._cmd.Parameters.Clear()&lt;br /&gt;
End Try&lt;br /&gt;
End Function&lt;br /&gt;
#End Region&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
its small but it will do the desired actions (minor actions) its good to be portable its clean and its easy to trace....&lt;br /&gt;
&lt;br /&gt;
more posts will be more advanced and comming soon thanks all&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-699156364235023059?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cflHo52JWHZQIPzfijzaie59SBU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cflHo52JWHZQIPzfijzaie59SBU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cflHo52JWHZQIPzfijzaie59SBU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cflHo52JWHZQIPzfijzaie59SBU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/dpPJjnBQp28" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/699156364235023059/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2008/07/some-aspnet-practices-to-share.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/699156364235023059?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/699156364235023059?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/dpPJjnBQp28/some-aspnet-practices-to-share.html" title="Some Asp.net practices to share" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.dsoftworld.com/2008/07/some-aspnet-practices-to-share.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cFQX44eyp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-738299995927363211</id><published>2008-06-05T10:42:00.004+03:00</published><updated>2011-04-15T23:23:30.033+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:23:30.033+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>WCF Windows Communication Foundation</title><content type="html">&lt;div align="center"&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;W   C    F&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for your services, enabling you to expose CLR types as services, and to consume other services as CLR types. Although in theory you could build services without WCF, in practice building services is significantly easier with WCF. WCF is Microsoft's implementation of a set of industry standards defining service interactions, type conversion, marshaling, and various protocols' management. Because of that, WCF provides interoperability between services. WCF provides developers with the essential off-the-shelf plumbing required by almost any application, and as such, it greatly increases productivity. The first release of WCF provides many useful facilities for developing services, such as hosting, service instance management, asynchronous calls, reliability, transaction management, disconnected queued calls, and security. WCF also has an elegant extensibility model that you can use to enrich the basic offering. In fact, WCF itself is written using this extensibility model. Most all of the WCF functionality is included in a single assembly called System.ServiceModel.dll in the System.ServiceModel namespace.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;WCF Service&lt;/strong&gt;:&lt;br /&gt;
&lt;br /&gt;
A service is a unit of functionality exposed to the world. In that respect, it is the next evolutionary step in the long journey from functions to objects to components to services. Service-orientation (SO) is an abstract set of principles and best practices for building SO applications. If you are unfamiliar with the principles of service-orientation, A service-oriented application (SOA) aggregates services into a single logical application similar to the way a component-oriented application aggregates components or an object-oriented application aggregates objects&lt;br /&gt;
&lt;br /&gt;
The services can be local or remote, developed by multiple parties using any technology, versioned independently, and even execute on different timelines. Inside a service, you will find concepts such as languages, technologies, platforms, versions, and frameworks, yet between services, only prescribed communication patterns are allowed.&lt;br /&gt;
The client of a service is merely the party consuming its functionality. The client can be literally anythinga Windows Forms class, an ASP.NET page, or another service.&lt;br /&gt;
Clients and services interact by sending and receiving messages. Messages may transfer directly from client to service or via an intermediary. With WCF, all messages are SOAP messages.&lt;a name="IDX-CHP-1-0005"&gt;&lt;/a&gt; Note that the messages are independent of transport protocolsunlike&lt;a name="IDX-CHP-1-0006"&gt;&lt;/a&gt; Web services, WCF services may communicate over a variety of transports, not just HTTP. WCF clients&lt;a name="IDX-CHP-1-0007"&gt;&lt;/a&gt; may interoperate with non-WCF services, and WCF services can interact with non-WCF clients. That said, typically if you develop both the client and the service, you could construct the application so that both ends require WCF to utilize WCF-specific advantages.&lt;br /&gt;
Because the making of the service is opaque from the outside, a WCF service typically exposes metadata&lt;a name="IDX-CHP-1-0008"&gt;&lt;/a&gt; describing the available functionality and possible ways of communicating with the service. The metadata is published in a predefined, technology-neutral way, such as using WSDL over HTTP-GET, or an industry standard for metadata exchange. A non-WCF client can import the metadata to its native environment as native types. Similarly, a WCF client can import the metadata of a non-WCF service and consume it as native CLR classes and interfaces.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;WCF Adresses:&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
In WCF, every service is associated with a unique address. The address provides two important elements: the location of the service and the transport protocol or transport schema used to communicate with the service. The location portion of the address indicates the name of the target machine, site, or network; a communication port, pipe, or queue; and an optional specific path or URI. A URI is a Universal Resource Identifier, and can be any unique string, such as the service name or a GUID.&lt;br /&gt;
WCF 1.0 supports the following transport schemas:&lt;a name="IDX-CHP-1-0013"&gt;&lt;/a&gt;&lt;br /&gt;
HTTP&lt;br /&gt;
TCP&lt;br /&gt;
Peer network&lt;br /&gt;
IPC (Inter-Process Communication over named pipes)&lt;br /&gt;
MSMQ&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;WCF Contracts:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does. WCF defines four types of contracts.&lt;br /&gt;
&lt;a name="IDX-CHP-1-0031"&gt;&lt;/a&gt;&lt;a name="IDX-CHP-1-0032"&gt;&lt;/a&gt;&lt;a name="IDX-CHP-1-0033"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Service contracts&lt;br /&gt;
&lt;/em&gt;Describe which operations the client can perform on the service.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Data contracts&lt;/em&gt;&lt;br /&gt;
Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but you can easily define explicit opt-in data contracts&lt;a name="IDX-CHP-1-0031"&gt;&lt;/a&gt; for custom types.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Fault contracts&lt;br /&gt;
&lt;/em&gt;Define which errors are raised by the service, and how the service handles and propagates errors to its clients.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Message contracts&lt;br /&gt;
&lt;/em&gt;Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format you have to comply with. As a WCF developer, you should use message contracts&lt;a name="IDX-CHP-1-0033"&gt;&lt;/a&gt; only rarely.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;WCF Hosting:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The WCF service class cannot exist in a void. Every WCF service must be hosted in a Windows process called the host process.&lt;a name="IDX-CHP-1-0053"&gt;&lt;/a&gt; A single host process can host multiple services, and the same service type can be hosted in multiple host processes. WCF makes no demand on whether or not the host process is also the client process. Obviously, having a separate process advocates fault and security isolation. It is also immaterial who provides the process or what kind of a process is involved. The host can be provided by IIS,&lt;a name="IDX-CHP-1-0054"&gt;&lt;/a&gt; by the Widows Activation Service (WAS) on Windows Vista, or by the developer as part of the application.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;WCF Binding:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
There are multiple aspects of communication with any given service, and there are many possible communication patterns: messages can be synchronous request/reply or asynchronous fire-and-forget; messages can be bidirectional; messages can be delivered immediately or queued; and the queues can be durable or volatile. There are many possible transport protocols for the messages, such as HTTP (or HTTPS), TCP, P2P (peer network), IPC (named pipes), or MSMQ. There are a few possible message encoding options: you can chose plain text to enable interoperability, binary encoding to optimize performance, or MTOM (Message Transport Optimization Mechanism)&lt;a name="IDX-CHP-1-0084"&gt;&lt;/a&gt; for large payloads. There are a few options for securing messages: you can choose not to secure them at all, to provide transport-level security only, to provide message-level privacy and security, and of course there are numerous ways for authenticating and authorizing the clients. Message delivery might be unreliable or reliable end-to-end across intermediaries and dropped connections, and the messages might be processed in the order they were sent or in the order they were received. Your service might need to interoperate with other services or clients that are only aware of the basic web service protocol, or they may be capable of using the score of WS-* modern protocols such as WS-Security and WS-Atomic Transactions. Your service may need to interoperate with legacy clients over raw MSMQ messages, or you may want to restrict your service to interoperate only with another WCF service or client.&lt;br /&gt;
If you start counting all the possible communication and interaction options, the number of permutations is probably in the tens of thousands. Some of those choices may be mutually exclusive, and some may mandate other choices. Clearly, both the client and the service must be aligned on all these options in order to communicate properly. Managing this level of complexity adds no business value to most applications, and yet the productivity and quality implications of making the wrong decisions are severe.&lt;br /&gt;
To simplify these choices and make them more manageable, WCF groups together a set of such communication aspects in bindings.&lt;a name="IDX-CHP-1-0085"&gt;&lt;/a&gt; A binding is merely a consistent, canned set of choices regarding the transport protocol, message encoding, communication pattern, reliability, security, transaction propagation, and interoperability. Ideally, you would extract all these "plumbing" aspects out of your service code and allow the service to focus solely on the implementation of the business logic. Binding enables you to use the same service logic over drastically different plumbing.&lt;br /&gt;
You can use the WCF-provided bindings as is, you can tweak their properties, or you can write your own custom bindings from scratch. The service publishes its choice of binding in its metadata, enabling clients to query for the type and specific properties of the binding because the client must use the exact same binding values as the service. A single service can support multiple bindings on separate addresses.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;WCF defines nine standard bindings:&lt;/em&gt;&lt;a name="IDX-CHP-1-0099"&gt;&lt;/a&gt;&lt;a name="IDX-CHP-1-0100"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Basic binding&lt;/em&gt;&lt;a name="IDX-CHP-1-0099"&gt;&lt;/a&gt;&lt;br /&gt;
Offered by the BasicHttpBinding class, this is designed to expose a WCF service as a legacy ASMX web service, so that old clients can work with new services. When used by the client, this binding enables new WCF clients to work with old ASMX services.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;TCP binding&lt;/em&gt;&lt;br /&gt;
Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Peer network binding&lt;/em&gt;&lt;br /&gt;
Offered by the NetPeerTcpBinding class, this uses peer networking as a transport. The peer network-enabled client and services all subscribe to the same grid and broadcast messages to it.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;IPC binding&lt;br /&gt;
&lt;/em&gt;Offered by the NetNamedPipeBinding class, this uses named pipes as a transport for same-machine communication. It is the most secure binding since it cannot accept calls from outside the machine and it supports a variety of features similar to the TCP binding.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Web Service (WS) binding&lt;br /&gt;
&lt;/em&gt;Offered by the WSHttpBinding class, this uses HTTP or HTTPS for transport, and is designed to offer a variety of features such as reliability, transactions, and security over the Internet.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Federated WS binding&lt;/em&gt;&lt;br /&gt;
Offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Duplex WS binding&lt;/em&gt;&lt;br /&gt;
Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client .&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;MSMQ binding&lt;/em&gt;&lt;a name="IDX-CHP-1-0100"&gt;&lt;/a&gt;&lt;br /&gt;
Offered by the NetMsmqBinding class, this uses MSMQ for transport and is designed to offer support for disconnected queued calls.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;MSMQ integration binding&lt;/em&gt;&lt;br /&gt;
Offered by the MsmqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;WCF Endpoint:&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Every service is associated with an address that defines where the service is, a binding that defines how to communicate with the service, and a contract that defines what the service does. This triumvirate governing the service is easy to remember as the ABC of the service. WCF formalizes this relationship in the form of an endpoint. The endpoint is the fusion of the address, contract, and binding. Every endpoint must have all three elements, and the host exposes the endpoint. Logically, the endpoint is the service's interface, and is analogous to a CLR or COM interface.&lt;br /&gt;
Every service must expose at least one business endpoint and each endpoint has exactly one contract. All endpoints&lt;a name="IDX-CHP-1-0132"&gt;&lt;/a&gt; on a service have unique addresses, and a single service can expose multiple endpoints. These endpoints can use the same or different bindings and can expose the same or different contracts. There is absolutely no relationship between the various endpoints a service provides.&lt;br /&gt;
It is important to point out that nothing in the service code pertains to its endpoints and they are always external to the service code. You can configure endpoints either administratively using a config file or programmatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This ends this post as an introduction to WCF later post will include more info and more advanced samples. Please free to comment .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-738299995927363211?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_W6Czmg6IBJq68Dj1uVekUtcVr4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_W6Czmg6IBJq68Dj1uVekUtcVr4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_W6Czmg6IBJq68Dj1uVekUtcVr4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_W6Czmg6IBJq68Dj1uVekUtcVr4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/PhEJ9JYDm_A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/738299995927363211/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2008/06/wcf-windows-communication-foundation.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/738299995927363211?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/738299995927363211?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/PhEJ9JYDm_A/wcf-windows-communication-foundation.html" title="WCF Windows Communication Foundation" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.dsoftworld.com/2008/06/wcf-windows-communication-foundation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cBSXg6cSp7ImA9WhZRGEQ.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-3181492709460664124</id><published>2007-09-27T15:28:00.002+03:00</published><updated>2011-04-15T23:24:18.619+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-15T23:24:18.619+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ADAM" /><category scheme="http://www.blogger.com/atom/ns#" term="AD" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="Active Directory Membership Provider" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>Active Directory Membership Provider</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;The ActiveDirectoryMembershipProvider supports almost the entire set of functionality&lt;br /&gt;
defined by the Membership API. You can create and manage users with either Active Directory&lt;br /&gt;
(AD) or the standalone directory product Active Directory Application Mode (ADAM).&lt;br /&gt;
Furthermore, you can use the provider in both ASP.NET and non-ASP.NET applications. Because&lt;br /&gt;
the ActiveDirectoryMembershipProvider closely mirrors the SqlMembershipProvider in&lt;br /&gt;
terms of functionality, the interesting parts of ActiveDirectoryMembershipProvider are how&lt;br /&gt;
the provider works with the directory server and how certain Membership operations are mapped&lt;br /&gt;
to AD and ADAM.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Provider Configuration&lt;br /&gt;
&lt;br /&gt;
If you configure the provider with the minimum number of required configuration attributes, most of its&lt;br /&gt;
functionality will work against existing AD installations. About all you need to get up and running is a&lt;br /&gt;
provider definition and a valid connection string:&lt;br /&gt;
&lt;connectionstrings&gt;&lt;br /&gt;
&lt;add connectionstring="”LDAP://mydomain.dns.name”/" name="”adconnection”"&gt;&lt;br /&gt;
&lt;/add&gt;&lt;br /&gt;
&lt;membership defaultprovider="”"&gt;&lt;br /&gt;
&lt;providers&gt;&lt;br /&gt;
&lt;clear&gt;&lt;br /&gt;
&lt;add ...”="" connectionstringname="”adconnection”" name="”someprovider”" type="”System.Web.Security.ActiveDirectoryMembershipProvider,"&gt;&lt;br /&gt;
&lt;/add&gt;&lt;br /&gt;
&lt;/clear&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is pretty much guaranteed that for production applications, though, you will need to delve a little&lt;br /&gt;
more deeply into the provider’s configuration. The section “Working with Active Directory” walks you&lt;br /&gt;
through a number of the common configuration tasks for setting up the provider.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Directory Connection Settings&lt;br /&gt;
&lt;br /&gt;
As with SQL provider, you need to at least supply a connection string so that the provider knows where&lt;br /&gt;
it should read and write data. However, unlike SQL Server connection strings, there is no such thing as&lt;br /&gt;
specifying explicit connection credentials inside of the connection string. Also connection security settings&lt;br /&gt;
cannot be supplied inside of an LDAP connection string. As a result, the provider supports a number&lt;br /&gt;
&lt;br /&gt;
The connection string that you use for the provider is placed in the &lt;connectionstrings&gt; section.&lt;br /&gt;
The provider references the connection string via the connectionStringName attribute. The connection&lt;br /&gt;
string that you create supports a number of different formats, depending on whether you are connecting&lt;br /&gt;
to AD or ADAM. For example, if you are running in a domain called foo.org and you have an AD&lt;br /&gt;
domain controller called dcserver, the most prevalent forms of the connection string when connecting&lt;br /&gt;
to AD look like:&lt;br /&gt;
❑ LDAP://foo.org&lt;br /&gt;
❑ LDAP://dcserver.foo.org&lt;br /&gt;
❑ LDAP://foo.org/OU=SomeOU,DC=foo, DC=org&lt;br /&gt;
❑ LDAP://dcserver.foo.org/OU=SomeOU,DC=foo,DC=org&lt;br /&gt;
However, if you are connecting to an ADAM server, you always need to have an application partition&lt;br /&gt;
defined. Assuming that you have an ADAM server called adambox in the foo.org DNS namespace, you&lt;br /&gt;
could use connection strings like:&lt;br /&gt;
❑ LDAP://adambox.foo.org/O=myorg,DC=foo,DC=org&lt;br /&gt;
❑ LDAP://adambox.foo.org/OU=SomeOU,O=myorg,DC=foo,DC=org&lt;br /&gt;
Unlike AD, ADAM servers can be listening on nondefault LDAP ports. If you install ADAM to listen on&lt;br /&gt;
other ports, then the connection string can look like:&lt;br /&gt;
❑ LDAP://adambox.foo.org:50001/O=myorg,DC=foo,DC=org&lt;br /&gt;
❑ LDAP://adambox.foo.org:50001/OU=SomeOU,O=myorg,DC=foo,DC=org&lt;br /&gt;
If you do install ADAM on a nondefault port, and you plan on using secure connectivity to the ADAM&lt;br /&gt;
server, you must make sure that SSL support has been configured properly on the ADAM server and on&lt;br /&gt;
each of the machines that needs to connect to the ADAM server. If you don’t change the default port settings&lt;br /&gt;
for ADAM, then SSL traffic by default occurs on port 636 (unsecured traffic occurs on port 389 by&lt;br /&gt;
default). If your ADAM server uses these default ports, then you don’t need to specify a port number in&lt;br /&gt;
the connection string.&lt;br /&gt;
Because both AD and ADAM can replicate changes across servers, the type of connection strings that&lt;br /&gt;
you use will have an effect on when the provider sees changes made on other machines. For example, if&lt;br /&gt;
you use an AD connection string that points only at a domain, it is possible that across a web farm different&lt;br /&gt;
web servers will end up connecting to different domain controllers. This can lead to odd behavior&lt;br /&gt;
where changes made to a MembershipUser on one server don’t show up immediately on other servers&lt;br /&gt;
in your farm. Unfortunately, there isn’t anything the provider itself can do to mitigate the inherent&lt;br /&gt;
latency of AD’s multimaster behavior. However, you can at least use connection strings that explicitly&lt;br /&gt;
specify a server—in this case all provider instances that are pointed at the same server will see a consistent&lt;br /&gt;
set of information.&lt;br /&gt;
One very important aspect of connecting to the directory server is connection security. From the sample&lt;br /&gt;
connection strings, you saw that there is no indication of the secured state of the connection. You request&lt;br /&gt;
security for the connection to the directory server via the connectionProtection provider configuration&lt;br /&gt;
attribute. This attribute can be set to either None or Secure. By default, if you do not specify the&lt;br /&gt;
attribute in your provider’s configuration, the provider will default to Secure.&lt;br /&gt;
&lt;br /&gt;
The reason that the attribute has only one of two settings is that attempting to expose the vagaries of&lt;br /&gt;
negotiating secure connections with a directory server can quickly become very complicated. So rather&lt;br /&gt;
than leaving it up to you to get things working, the provider simplifies the issue into a simple binary&lt;br /&gt;
decision. Either you want connection security automatically established, or you don’t. Of course, there is&lt;br /&gt;
a bit more complexity than that occurring underneath the hood. There are a number of mix-and-match&lt;br /&gt;
combinations you can use with connectionProtection and the credentials used by the provider when&lt;br /&gt;
connecting to the directory, though only a subset of settings really make sense.&lt;br /&gt;
&lt;br /&gt;
❑ connectionProtection=None for AD—This is not a combination you should ever use. In&lt;br /&gt;
AD environments, any operations that set or change passwords must be done over secure connections,&lt;br /&gt;
so with a setting of None, the provider will always fail when it attempts things like&lt;br /&gt;
ChangePassword or ResetPassword. Also, you need to always use explicit connection credentials&lt;br /&gt;
with this setting. Because AD has built-in support for automatically securing connections&lt;br /&gt;
there isn’t much reason for ever using None in an AD environment.&lt;br /&gt;
&lt;br /&gt;
❑ connectionProtection=None for ADAM—You may find yourself using this combination in&lt;br /&gt;
a development environment where you don’t have SSL certificates set up for your ADAM&lt;br /&gt;
server and client machines. As with AD, you will need to configure the connection credentials&lt;br /&gt;
explicitly to use the None setting. Note that for ADAM this means that you will be limited to&lt;br /&gt;
using only ADAM user principals for the explicit credentials; domain credentials cannot be&lt;br /&gt;
explicitly specified for ADAM when connectionProtection is set to None. Unlike AD,&lt;br /&gt;
though, you can manually configure ADAM to allow password changes and resets to occur over&lt;br /&gt;
unsecured connections. The section on “Using ADAM” later in the chapter shows you how to&lt;br /&gt;
do this. Note though that I would not recommend using None in a production setting with&lt;br /&gt;
ADAM; it only makes sense as a convenience early on during a development cycle. Even for&lt;br /&gt;
development scenarios, at some point you should get SSL set up so that you are coding in an&lt;br /&gt;
environment that more closely matches your deployment environment.&lt;br /&gt;
&lt;br /&gt;
❑ connectionProtection=Secure for AD—This is the default when connecting to an AD&lt;br /&gt;
server, and it is the setting that you should use for most cases when working with AD.&lt;br /&gt;
Internally, the provider will first make a check to see if SSL is supported on the directory server.&lt;br /&gt;
If it is, all LDAP traffic will flow over Active Directory’s SSL port (that is, port 636). If SSL is not&lt;br /&gt;
configured for AD, which is normally the case for at least intranet directory servers, then the&lt;br /&gt;
provider will fall back and use signing and sealing for all LDAP traffic. If you have configured&lt;br /&gt;
SSL in an extranet directory environment for example, then the provider will make use of SSL&lt;br /&gt;
in preference to signing and sealing. Because the provider internally makes use of the Active&lt;br /&gt;
Directory Services Interface (ADSI) API, it turns out that setting up SSL for AD environments&lt;br /&gt;
gives the best performance when using the provider to connect securely to AD. Using SSL&lt;br /&gt;
reduces the number of network connections that ADSI will open on behalf of the provider when&lt;br /&gt;
making secure connections to AD.&lt;br /&gt;
&lt;br /&gt;
❑ connectionProtection=Secure for ADAM—This is the default when connecting to an&lt;br /&gt;
ADAM server. As noted earlier, this setting will not work unless you have explicitly set up SSL&lt;br /&gt;
on your ADAM server as well as on all machines that need to communicate with that server.&lt;br /&gt;
The reason for this restriction is that unlike when connecting to AD, the provider only supports&lt;br /&gt;
the use of SSL for securing network traffic with the ADAM server. Even if the ADAM instance is&lt;br /&gt;
running on a server joined to a domain, the provider will not attempt to use signing and sealing.&lt;br /&gt;
When you set connectionProtection to Secure, you can find out the actual connection security that&lt;br /&gt;
was chosen at runtime by querying the provider’s CurrentConnectionProtection property. This&lt;br /&gt;
property returns a value from the System.Web.Security.ActiveDirectoryConnectionProtection&lt;br /&gt;
enumeration that will tell you if SSL or signing and sealing were chosen.&lt;br /&gt;
of additional configuration settings.&lt;br /&gt;
&lt;br /&gt;
The last set of connection information that you can configure in the provider’s &lt;add&gt; element is explicit&lt;br /&gt;
connection credentials. The configuration attributes connectionUsername and connectionPassword&lt;br /&gt;
can be used to explicitly specify the username and password to use when connecting to the directory&lt;br /&gt;
server. If you don’t explicitly specify values for these settings the provider attempts to connect to the directory&lt;br /&gt;
using either the process credentials from the IIS6 worker process, or the application impersonation&lt;br /&gt;
credentials if application impersonation is in effect. If you explicitly specify the username and password,&lt;br /&gt;
make sure to use protected configuration (discussed in Chapter 4) so that the credentials are not stored in&lt;br /&gt;
cleartext on your production servers.&lt;br /&gt;
The format of the username differs, depending on whether you are connecting to AD or ADAM:&lt;br /&gt;
&lt;br /&gt;
❑ AD—You can specify the username in any format that is supported by Windows. The two most&lt;br /&gt;
common username formats are the NT4-style format of DOMAIN\USERNAME and the user principal&lt;br /&gt;
name format of &lt;a href="mailto:username@domain.name"&gt;username@domain.name&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
❑ ADAM—If you are connecting to an ADAM server with connectionProtection set to Secure,&lt;br /&gt;
then you can explicitly specify either an ADAM user principal or a domain user account. For a&lt;br /&gt;
protection setting of None though, only an ADAM user principal can be specified. An ADAM&lt;br /&gt;
principal looks something like CN=Username,OU=AccountOU,O=MyOrganization,DC=corsair,&lt;br /&gt;
DC=com. In the section on “Using ADAM,” there is a walkthrough of how to use an&lt;br /&gt;
ADAM user principal when connecting to an ADAM server.&lt;/add&gt;&lt;/connectionstrings&gt;&lt;/providers&gt;&lt;/membership&gt;&lt;/connectionstrings&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;connectionstrings&gt;&lt;membership defaultprovider="”"&gt;&lt;providers&gt;&lt;connectionstrings&gt;&lt;add&gt;Check the new post on Active &lt;a href="http://saloweblife.blogspot.com/2011/03/active-directory-membership-provider.html" linkindex="17"&gt;Directory Membership Provider&lt;/a&gt; &lt;/add&gt;&lt;/connectionstrings&gt;&lt;/providers&gt;&lt;/membership&gt;&lt;/connectionstrings&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-3181492709460664124?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fQK9lVaBf8f-jIgsxwh5liALkkI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fQK9lVaBf8f-jIgsxwh5liALkkI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fQK9lVaBf8f-jIgsxwh5liALkkI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fQK9lVaBf8f-jIgsxwh5liALkkI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/UEeM8Gffqxg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/3181492709460664124/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2007/09/active-directory-membership-provider.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/3181492709460664124?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/3181492709460664124?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/UEeM8Gffqxg/active-directory-membership-provider.html" title="Active Directory Membership Provider" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.dsoftworld.com/2007/09/active-directory-membership-provider.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MMSX47fyp7ImA9WhZXFUw.&quot;"><id>tag:blogger.com,1999:blog-3723656887997278521.post-926758337664083734</id><published>2007-09-21T17:16:00.002+03:00</published><updated>2011-05-04T16:24:48.007+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-04T16:24:48.007+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JSON" /><category scheme="http://www.blogger.com/atom/ns#" term="JSON versus XML" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><category scheme="http://www.blogger.com/atom/ns#" term="dotnet" /><title>JSON</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;a href="" name="411"&gt;&lt;/a&gt;&lt;a href="" name="ch07lev1sec1"&gt;&lt;/a&gt;Overview:&lt;br /&gt;
&lt;br /&gt;
With the still-rising popularity of web services, XML has practically become the de facto standard for data transmission. However, XML is not without its detractors. For example, some consider it to be overly verbose for data transmission purposes, necessitating many more bytes of information to be sent across the Internet to accomplish what could have been done in a much smaller form. To take this into consideration, new forms of XML compression and even entire new XML formats, such as Binary XML, have been developed. All these solutions work on extending or adding on to XML, making backwards compatibility an issue. Douglas Crockford, a long-time software engineer, proposed a new data format built on JavaScript called JavaScript Object Notation (JSON).&lt;br /&gt;
Up until this point, you've used either plain text or XML to transmit data back and forth to the server. This chapter introduces the use of JSON in Ajax communication as an alternative to these more traditional data formats.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="" name="412"&gt;&lt;/a&gt;&lt;a href="" name="ch07lev1sec2"&gt;&lt;/a&gt;What Is JSON?&lt;br /&gt;
&lt;br /&gt;
JSON is a very lightweight data format based on a subset of the JavaScript syntax, namely array and object literals. Because it uses JavaScript syntax, JSON definitions can be included within JavaScript files and accessed without the extra parsing that comes along with XML-based languages. But before you can use JSON, it's important to understand the specific JavaScript syntax for array and object literals.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="" name="422"&gt;&lt;/a&gt;&lt;a href="" name="ch07lev1sec3"&gt;&lt;/a&gt;JSON versus XML&lt;br /&gt;
&lt;br /&gt;
One of the advantages of JSON over XML is that it's more compact. XML is considered by some to be overly verbose for its purpose. But what does this mean exactly? Consider the following XML data:&lt;br /&gt;
&lt;classinfo&gt;&lt;br /&gt;
&lt;students&gt;&lt;br /&gt;
&lt;student&gt;&lt;br /&gt;
&lt;name&gt;Michael Smith&lt;/name&gt;&lt;br /&gt;
&lt;average&gt;99.5&lt;/average&gt;&lt;br /&gt;
&lt;age&gt;17&lt;/age&gt;&lt;br /&gt;
&lt;graduating&gt;true&lt;/graduating&gt;&lt;br /&gt;
&lt;/student&gt;&lt;br /&gt;
&lt;student&gt;&lt;br /&gt;
&lt;name&gt;Steve Johnson&lt;/name&gt;&lt;br /&gt;
&lt;average&gt;34.87&lt;/average&gt;&lt;br /&gt;
&lt;age&gt;17&lt;/age&gt;&lt;br /&gt;
&lt;graduating&gt;false&lt;/graduating&gt;&lt;br /&gt;
&lt;a href="" name="423"&gt;&lt;/a&gt;&lt;a href="" name="IDX-196"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/student&gt;&lt;br /&gt;
&lt;student&gt;&lt;br /&gt;
&lt;name&gt;Rebecca Young&lt;/name&gt;&lt;br /&gt;
&lt;average&gt;89.6&lt;/average&gt;&lt;br /&gt;
&lt;age&gt;18&lt;/age&gt;&lt;br /&gt;
&lt;graduating&gt;true&lt;/graduating&gt;&lt;br /&gt;
&lt;/student&gt;&lt;br /&gt;
&lt;/students&gt;&lt;br /&gt;
&lt;/classinfo&gt;&lt;br /&gt;
This example contains information about three students in a class. Right away, there is some XML information that isn't entirely necessary: the &lt;classinfo&gt; and &lt;students&gt; elements.&lt;/students&gt;&lt;/classinfo&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt; These elements help to define the overall structure and meaning of the information, but the actual information you're interested in is the students and their information. Plus, for each piece of information about the students, the name of the information is repeated twice, although the actual data is repeated only once (for example, "name" appears both in &lt;name&gt; and &lt;/name&gt;. Consider the same information formatted as JSON:&lt;br /&gt;
{ "classinfo" :&lt;br /&gt;
{&lt;br /&gt;
"students" : [&lt;br /&gt;
{&lt;br /&gt;
"name" : "Michael Smith",&lt;br /&gt;
"average" : 99.5,&lt;br /&gt;
"age" : 17,&lt;br /&gt;
"graduating" : true&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
"name" : "Steve Johnson",&lt;br /&gt;
"average" : 34.87,&lt;br /&gt;
"age" : 17,&lt;br /&gt;
"graduating" : false&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
"name" : "Rebecca Young",&lt;br /&gt;
"average" : 89.6,&lt;br /&gt;
"age" : 18,&lt;br /&gt;
"graduating" : true&lt;br /&gt;
}&lt;br /&gt;
]&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
As you can see, a lot of the superfluous information isn't present. Since closing tags aren't necessary to match opening tags, it greatly reduces the number of bytes needed to transmit the same information. Not including spaces, the JSON data is 224 bytes, whereas the comparable XML data is 365 bytes, saving more than 100 bytes. (This is why Crockford, JSON's creator, calls it the "fat free alternative to XML.")&lt;br /&gt;
The disadvantage to JSON-formatted data as compared to XML is that it's less readable to the layperson. Because XML is verbose, it's fairly easy to understand what data is being represented. JSON, with its shorthand notation, can be difficult to decipher using the naked eye. Of course, an argument can be &lt;a href="" name="424"&gt;&lt;/a&gt;&lt;a href="" name="IDX-197"&gt;&lt;/a&gt;made that data exchange formats should never be viewed with the naked eye. If you're using tools to create and parse the data being passed back and forth, then there is really no reason to have the data be human readable. But this begs the question: Are there any JSON tools available? The answer is yes.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3723656887997278521-926758337664083734?l=www.dsoftworld.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mroJtaQ3-5OSFCackQTqJzHpUwI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mroJtaQ3-5OSFCackQTqJzHpUwI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mroJtaQ3-5OSFCackQTqJzHpUwI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mroJtaQ3-5OSFCackQTqJzHpUwI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/FnIae/~4/ptO6_MsoP2Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.dsoftworld.com/feeds/926758337664083734/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.dsoftworld.com/2007/09/json.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/926758337664083734?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/3723656887997278521/posts/default/926758337664083734?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/FnIae/~3/ptO6_MsoP2Q/json.html" title="JSON" /><author><name>Salah Awad</name><uri>http://www.blogger.com/profile/17204398534387978022</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="33" height="25" src="http://3.bp.blogspot.com/-n2p7UDnPve0/TWls6nmhJHI/AAAAAAAAACE/hb_RQs5DrTo/s220/a1.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.dsoftworld.com/2007/09/json.html</feedburner:origLink></entry></feed>

