Year: 2014
-
Generics in WCF Data Contract
In my WCF training, I often get questions that can we expose a generic type as DataContract in WCF? Yes, WCF allows us to expose the generic types as Data Contract. Let us say we have a generic type Foo. We can apply data contract on the Foo as follows: We can use Foo<T>…
-
Data Contract Serialization Events in WCF
In WCF we use the DataContract to serialize and deserialize the custom data. Sometime you may come across a scenario do some work before or after the data gets serialized or deserialized. These are following four events provided on the DataContract. You are free to give any method name provided method should return void and…
-
Multiple bindings in self-hosted WCF Service
Even though WCF is now, more than 5 years old but still I see developers struggling with the multiple bindings specially when hosted in a managed console application. In this post, step by step we will learn to create a WCF Service with multiple bindings and host the service in a managed console application. We…
-
An error was raised by libgit Category =Ssh error: solved git for Visual Studio
Have you come across the error as shown in below image? You get the above shown error in Visual Studio while pulling changes from the git server. This error causes because you have local changes without the commit. In this scenario the visual Studio does not give very readable error message. Perhaps you may want…
-
Property Initializers in C-Sharp 6.0
In the C-Sharp 3.0 a new feature Automatic property got introduced. It allows us to create a class as a bag of the setters and the getters. You can create a class as follows: Each property is backed by a backing filed. When you set value of the property, setter gets executed to set the…
-
Exception Filters in C-Sharp 6.0
So far we deal with the Exceptions as below. As you see in the following code snippet, we are catching the exception and displaying the error message. Challenge in the above snippet is that you cannot apply filter to the exception. Of course you can have if-else statement inside the try catch block but it…
-
Child Actions in ASP.NET MVC
Read full post on falafel blog Child Actions are the action methods which can be invoked within the view. This is used to work with the data in the view, which are not related to the main action method. For example, if you want to create a data driven widget in the view using data…
-
Prototypical inheritance in JavaScript
Read full post on falafel blog Before we can understand prototypical inheritance, let us start with a problem statement. You have a student for whom you need to: Calculate their grade Print the grade In JavaScript this can be simply implemented as follows: There are some inherent problems in the above approach: Variables are defined…
-
Video : One to one relationship between entities in Entity Framework Code First
Container.cs Product.cs EFContext.cs
-
Check User exists in a Role in ASP.NET Identity 2.0
Read full post on Falafel blog ASP.NET MVC5 uses Identity 2.0 to manage the users and their roles. There may be scenario to check whether the currently logged in user or any user with the id exists in the given role or not, and checking can be done either in the controller class or in…