WCF Instance Context Mode and Bindings


As well known, the instance context mode property of Service Behavior can have these three values.
  • PerCall - New instance is created for each client request.
  • PerSession -  New instance is created for each new client session, and will be available throughout the session
  • Single - Only one instance handles for all client requests throughout the application 
Example:

[ServiceBehavior(
     InstanceContextMode = InstanceContextMode.PerSession)]
 public class Service1 : IService1
    { 
       ...
    }

Now, what is the default value for the InstanceContextMode? I wrote a quick WCF app, and drilled down in debug mode.













As you might see, if you examine OperationContext.Current.InstanceContext and examine the Behaviour, you'll find useSession set to true, which means, it is PerSession.

But wait, let me change the binding to basicHttpBinding from wsHttpBinding - and let us have a look again.












Now you'll find that useSession is false, which means, the context mode is defaulting to PerCall, because basicHttpBinding can't support sessions. So the inference is, for bindings that support session, the default is PerSessions, other wise it is perCall.

Now, change the context mode in your service attribute to Single, and see what happens to the singleton variable in Behavior, in the above watch.
Read more >>

Weekend Hacks - .NET Soup for the passionate Soul




About Week End Hacks - Most weekends I do some digging around new and emerging technology and geek stuff. I do this by picking the links I bookmarked, or by going through the tweets I Favorited in Twitter.


This weekend, it was some real fun and seems that I was frantically going through various stuff, partly related to a fun project I'm doing with SL and Live Mesh.


I was just going through my browser history, and got amazed with the stuff I went through this weekend. Here is a couple of useful links you might want to check out.


1Managed Extensibility Framework - Home - MEF enables greater reuse of applications and components. Using MEF, .NET applications can make the shift from being statically compiled to dynamically composed. If you are building extensible applications, extensible frameworks and application extensions, then MEF is for you.


2.NET "must-have" development tools - Stack Overflow - A good list of free tools available for .NET development


 3Microsoft Health Common User Interface - Release: Release An LOB reference application in Silverlight


4Silverlight 3 Out-of-Browser Apps vs. Live Framework Mesh-Enabled Web Application - Good read if you are interested in Silverlight and Live Mesh 


5Live Framework SDK and Tools - Started with a weekend hack on creating a Live Mesh application. If you want to start with Live Mesh, download this SDK and tools


6Glimmer: a jQuery Interactive Design Tool - Home - Glimmer helps you create nice JQuery interfaces quickly and easily. Must see if you are a fan of JQuery


7Coding4Fun : Twitterlight: A Silverlight Twitter client - Have a look at this silverlight twitter client.


Building a Live Mesh Silverlight Application | WPF Dev  - Some good intro towards starting building your on Live Mesh silver light application.


Planning to update cool links from my history on every weekend, Subscribe or Follow me on twitter
Read more >>

Skillset required for working in a Silverlight Project


Recently I was requested by the sourcing team to list down the skill set required for candidates for a Silverlight project. Here is something that I wrote as Job Descriptions, for each role.
UX Designer Profile
  • Ability to visualize and create user experiences, and to translate them to UI designs using Expression Blend
  • Excellent understanding of XAML and capabilities of Silverlight
  • Excellent understanding of creating and applying styles and templates
  • Ideal candidate will have been working with Silverlight 1.0 since its inception, with examples showing level of expertise with an understanding of enhancements made with 2.0 and 3.0.
Silverlight Architect
  • Ability to guide the team by putting in place the required tools and frameworks (end to end) for Silverlight specific projects
  • Experience using Expression Blend and Visual Studio for Silverlight application development
  • Good understanding of XAML Styles, Triggers, Observable Collection, Data Binding Methods, Model View View-Model (MVVM) pattern, Navigation patterns
  • XML and LINQ within Silverlight
  • All aspects of Silverlight framework including DLR, Isolated storage etc
  • Understanding about essential application blocks like Composite application block (Prism) Excellent understanding on using RIA, WCF services and ADO.NET Entity framework services with Silverlight
  • Excellent knowledge of development within .NET 3.0 & 3.5 Framework
  • Must understand the fundamentals of software development, including best practices and OOP design patterns. An understanding of cross-browser Front-end development issues is important
  • Knowledge about 3rd party UI libraries
  • Familiarity in Live Mesh technologies
Silverlight Developer
  • Experience using Expression Blend and Visual Studio for Silverlight application development
  • Excellent C# and XAML skills
  • Experience in using MVVM
  • Strong JavaScript skills
  • Working knowledge of development within .NET 3.0 & 3.5 Framework
Read more >>

Published Software Design Patterns For Everyone Ebook

Aggregated some of my earlier articles on design patterns (I published in code project), and published an e-book on the same over Scribd. The objective is to introduce software design patterns to you in a simple, human readable, and funny (?) way - in the context of designing a soccer engine - By discussing the thought process behind applying design patterns

This book is actually the compilation of two articles I wrote on ‘Applying Design Patterns’ – Part I & 2 and Part 3 & 4

You can now download the PDF directly here. It is also available via Scribd.

Software Design Patterns Made Simple
Read more >>

top