Business Connectivity Services

May 19, 2015

Presentation Content : BCS Architecture , BCS Connectors , BCS Development Trends

Content Reference:!As0HddhY04bsp23B-N_CtGBz8tW-
Presentation Reference:!As0HddhY04bsj3P4_gSEHu8gkXiD

Software Architecture-Strange-Problem in Visual Studio 2010

February 25, 2012

When was trying to add a new project to solution, I faced following prompt error from Visual studio 2010:
“the length of the full path for the solution, project or item you are created exceeds the maximum path length allowed by the system”
Really surprising to see that because my project location length was only 143 characters long.
My operating system was windows 7 64 bit.

Did a little bit of googling to know that it is by design from Microsoft……… Strange …..:)
There is no work round, path limit is imposed via the operating system API used by VS 2010 so we cannot have a project name path longer .you have to make a smaller project location.

So bad ..bad…if a third party product has any such limitation, then it is understanding …But from Microsoft who also creator of windows-the underline operating system- it is tooo bad….

Let hope it will get fixed in next version of visuals studio…..

Software Architecture-Increase development productivity

January 31, 2012

Today it is the last day of month and Yes, Yes, again it is more than a month and I am still not able to give time to this blog…….One reason is that I am recently married, so life was really busy in family things……:)

But still I need to be more focus on objectives and target for this blog.
Secondly, I need to make more productive use of time and efforts.
Searched on net and founds following tips for productivity increase.
1. Create Keyboard shortcuts for repetitive tasks. Learn shortcut keys for common windows operations. Use short keys for visual studio 2010 at following location. Not Just completing a office task is important , main things is to get full control over domain of whatever you are doing is very important.
Programming language, business rules and technology skills must be fully understood to make more output for a give time.
1 hrs spend in learning/getting full control things, can save your a lot of time in future.

3. Planning your time is very important for better productivity. Often weak planning , results in chaos and waste valuable time. Divide bigger task into smaller pieces and track each item separately.

4. Make extensive use of Visual studio productivity tools.

For visual studio 2010, locatedhere

5. POC, instead of main product/project.
Any new feature that need to be added to project or product must be implemented as separate project. Because software development is basically a Research and development field, so POC-Proof of concept style of strategy is best suited and makes things more productive in long run.
6. Automate mostly of software development things with Application Lifecycle Management (ALM) tools. Build process automation via TFS. Continuously Integration by wiring Tests with build process improve things. So automate things as much as possible. Use .bat files heavily to automate the tasks.

7. While doing development related to AD, SharePoint and IIS create environments and scenarios via Power shell scripts. That makes things very productive for development.

Software Architecture-To find public key token of an assembly

August 21, 2011

Objective: To find public key token of an assembly.
Strong name utility named sn.exe can be used to find the public key token of an assembly as below:

c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sn.exe -T C:\Windows\Mic

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Public key token is b03f5f7f11d50a3a

c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sn.exe -T C:\Windows\Mic

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Public key token is b77a5c561934e089

Second way is to wire thing in Visual studio 2010, Go to Tools>>External Tools and add new tool by providing:
Title: Get Public Key Token
Command: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\sn.exe
Arguments: -T $(TargetPath)
Check the Use Output Window checkbox. So screen looks like as:

Now click on menu in tools as “Get Public Key Token” to see the public key token of current assembly in output window as:

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.
Public key token is 4cb554340e8b008b


Software Architecture – RESTful WCF Services for .Net Framework 4.0/Visual Studio 2010

May 14, 2011

According to Wiki, Restful Webs services are described as:

A RESTful web service (also called a RESTful web API) is a simple web service implemented using HTTP and the principles of REST. It is a collection of resources, with three defined aspects:
•the base URI for the web service, such as
•the Internet media type of the data supported by the web service. This is often JSON, XML or YAML but can be any other valid Internet media type.
•the set of operations supported by the web service using HTTP methods (e.g., POST, GET, PUT or DELETE).

For programming Restful services in .Net Framework, till visual studio 2008 sp1, there was a separate kit for named “WCF REST Starter Kit Preview 2” at:

But it was not upgraded for Visual studio 2010. So for Visual studio 2010/.Net 4.0, search WCF+REST related items in Visual studio gallery.

One of the best template by WCF Team in Microsoft is as below:

Download file named “WcfRestService40(CS).vsix”, and double click to install the template.

Now a new project type named “WCF REST Service application” is added.

I created a new project based on new project type named “WcfRestServiceApp”.

Added a console project to solution for running service named “ServiceServerApp”, with following code

WcfRestServiceApp.Service1 serv = new WcfRestServiceApp.Service1();
            WebServiceHost host = new WebServiceHost(serv, new Uri("http://localhost/WCFRESTService/"));
            Console.WriteLine("Service is running....Press enter to stop the service...");

When you try to run service, you will get following error:

In order to use one of the ServiceHost constructors that takes a service instance, the InstanceContextMode of the service must be set to InstanceContextMode.Single.  This can be configured via the ServiceBehaviorAttribute.  Otherwise, please consider using the ServiceHost constructors that take a Type argument.

As error explains, I have to change InstanceContextMode from InstanceContextMode.PerCall
to InstanceContextMode.Single

After that I got following error:

HTTP could not register URL http://+:80/WCFRESTService/. Your process does not have access rights to this namespace (see for details).

So solution is to run following command incase of windows 7.

netsh http add urlacl url=http://+:80/WCFRESTService/  user=juliet\shah

For theory details see the link above.

So I am ready with service running .

While analyzing code of template, two things are important to note.
•Template uses the WebGetAttribute and WebInvokeAttribute to associate service operations with both GET and other HTTP verbs like PUT, POST, and DELETE.
•Template uses the UriTemplate and UriTemplateTable classes to provide URI processing capabilities.
For details about theory visit following

That all from my side for RestFull web Services in .Net framework 4.0/Visual studio 2010

Software Architecture – What is exactly Tuple in C# – Compare with classes, structures,Array,ArrayList,List

March 20, 2011

In previous post at Software Architecture – C# – 4.0 – New Feature – Tuple , I introduced Tuples. During a presentation Badar-one of my team mate asked me question that why we need a new type tuple-When there are already classes,structures,Array,ArrayList,List. So I posting my reply.

Actually Microsoft is growing C# as most prowerfull programming langauge, so they contionously extend the core language element. Tuple has been there in Pythone and F# previously, now with c# 4.0, it is also part of core c# syntyx.

Comparsion with Class/Structure:
So problem defination is that we want to group together related values/ types into one type.
First thing comes in mind to have Class and contain all elements to be grouped in side a class. Sounds good,but there are cases when there no objec t oriented concept related to grouping. Class comes with heavy concepts like Encapsulation,Pholymorphism,abstraction,inheritence,constructor and a lot more… So when grouping is required but there is no OO sense, then Tuples are best choice.
You may point out that Structures are also there. Again there have attached concepts like inheritence,constrcutor,methods,properties and lot more. So when just grouping is required but no Object oriented concepts, tuples are the best choices.

Comparsion with Array/ArrayList/List:
No..No you can’t compare Tuple with Array/ArrayList/List.Because of simple point that Tupe is treated as data type and Array/ArrayList/List are treated as data strcutures. Just visualise the basic course with “Data Structure” in BCS, you will know the differenc e. Array/Arraylist/List are affilated with general concepts of Data structure like sorting , searc hing and a lot more. For Tuple we don’t have any such concept. It is simple Grouping og related values/types.

Getting and Setting elements in tupes is totally different from other Data strcutures like Array,ArrayList/List.

Secondly, elements in array are not strongly types(Require a type casting),but elements of Tuples are strongly typed.

Software Architecture – IntelliTrace is a historic debugger

March 14, 2011

IntelliTrace is a historic debugger which acts like a Flight recorder or DVR Recorder.
It is only available in Visual studio 2010 ultimate.

According to MSDN:

Here are some examples of how IntelliTrace can save you time:

>>You set a breakpoint near the start of your application. After observing the state of your application at that point, you continue execution. Later, you decide you want to go back and look at the first breakpoint hit again. Without IntelliTrace, you would have to restart your application. By using IntelliTrace, you can find the breakpoint event in the IntelliTrace window, and then click the breakpoint to view the state of your application at the time that the breakpoint was hit. State information includes variables that you have examined previously through DataTips or variable windows.

>>You discover that your application has corrupted a data file or a registry entry, but you do not know where the file or registry corruption has occurred. Without IntelliTrace, you would have to look through your code to find all possible file or registry accesses, place breakpoints on those accesses, then rerun your application to find where the problem occurs. By using IntelliTrace, you can see all registry- or file-access events that have been collected and the state of your application at the time each event occurred.

>>An exception occurs. Without IntelliTrace, you receive an exception message that states the nature of the exception but you have limited information on events that led up to the exception. You can examine the call stack to see the chain of calls that led up to the exception but you cannot examine the sequence of events that occurred during those calls. By using IntelliTrace, you can examine events that occurred at multiple times prior to the exception.

Best video to get explination about IntelliTrace is as:

Some others are as below:

Enjoy debugging.

Software Architecture-Exception-Snapin project-Porting from .Net 3.5 to .Net 4.0

March 13, 2011


Could not load file or assembly ‘XXXXX, Version=5.5.3484.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

There is a snapin project in solution. After porting solution from visual studio 2008/.Net 3.5 to visual studio 2010, the above exception is appearing.

Add an environmental variable named COMPLUS_Version with value v4.0.30319 where v4.0.30319 is your version of .Net framework
This change will solve the above problem.

Software Architecture-New Features of Visual Studio 2010 / .Net 4.0

February 27, 2011

Topic: New Features of Visual Studio 2010 / .Net 4.0
Date: 28 Feb 2010
By: Shahzad Sarwar

Software Architecture-ExpandoObject Class of System.Dynamic namespace in C# 4.0

February 26, 2011

In previous few posts[ Introduction to Dynamic Type , Overloading with dynamic and Dynamicobject Class ] we explored new type dynamic in c# 4.0.
In System.Dynamic namespace, Microsoft introduced many classes related to dynamic language support in c#. One of the main class is ExpandoObject, which according to MSDN is defined as: “Represents an object whose members can be dynamically added and removed at run time.”
The ExpandoObject class is an implementation of the dynamic object concept that enables getting, setting, and invoking members.
Lets do some testing on this class.

dynamic calculator = new ExpandoObject();

            // Set properties
            calculator.Name = "Shahzad's Calulator....";
            calculator.Made= "Cesco";
            calculator.Price = 100;

            // Add methods
            calculator.AddNumbers = new Action<int, int>((i1, i2) => Console.WriteLine("Result for AddNumbers : {0}", (i1 + i2)));

            // Show state
            Console.WriteLine("Properties: Name:{0} , Made:{1}  , Price:{2}", calculator.Name, calculator.Made, calculator.Price);

            // Call method
            calculator.AddNumbers(5, 6);

            //Listing all properties
            Console.WriteLine("Listing all properties");
            foreach (var property in (IDictionary<String, Object>)calculator)
                Console.WriteLine(property.Key + ": " + property.Value);

            // Remove property
            ((IDictionary<String, Object>)calculator).Remove("Name");

            //Listing all properties
            Console.WriteLine("Listing all properties- After Removal of Name");
            foreach (var property in (IDictionary<String, Object>)calculator)
                Console.WriteLine(property.Key + ": " + property.Value);

            Console.WriteLine("Lets see: " + calculator.Color); //'System.Dynamic.ExpandoObject' does not contain a definition for 'Color'


Comments explain everything.