Execute T-SQL Statements in Entity Framework 4

November 25, 2009

Execute T-SQL Statements in Entity Framework 4 In this post I’m going to show a new Entity Framework 4 feature that enable us to execute T-SQL from the ObjectContext directly to the database. Executing T-SQL Statements from ObjectContext One of the new improvements in EF4 is the ability to execute T-SQL store queries and commands. This ability enable the EF developer to execute T-SQL directly against the database....

Applying Strategy Pattern Instead of Using Switch Statements

November 22, 2009

Applying Strategy Pattern Instead of Using Switch Statements Once in a while I’m stumbling on switch statements during a Code Review session. Whenever this is happening my first reaction is to understand why did the developer use it. Since using switch statement sometime implies spaghetti code and also can get very crowded (in case statements of course) in this post I’m going to show an alternative method that I prefer to use. Alternative Method for Switch Statements Whenever you start to use a switch statement you should ask yourself whether you can use Strategy Pattern instead. The Strategy Pattern help us to...

Using External Configuration File for Enterprise Library Configuration

November 15, 2009

Using External Configuration File for Enterprise Library Configuration One of the things that I always do when I’m using Enterprise Library is to separate its configurations to external configuration file. The reason is very obvious – using Enterprise Library makes configuration files very crowded. Since this is the case, the configuration files become unmanageable and then its time to separate the Enterprise Library’s configurations from other configurations. How to Use external Configuration File for Enterprise Library Configuration? It is very simple to separate the Enterprise Library configurations to another external file. Step 1 Create a new configuration file in the solution...
one comment

Velocity Cache Notifications

November 13, 2009

Velocity Cache Notifications I’ve been asked by a friend how to use cache notifications in Velocity. if you don’t know, Velocity, Microsoft distributed cache, offers a cache notification mechanism that can help you to get notified when cache operations occur. This post will help you to get started with Velocity cache notifications. Cache Notifications As written earlier, Velocity has a cache notifications feature. That feature enables us to get notified when cache operations occur in our cache cluster. What happens when this feature is enabled is that we get asynchronous cache notifications for many aspects of the cluster including the cache,...

Working with Large Databases in Entity Framework

Working with Large Databases in Entity Framework Yesterday I was asked by a colleague a very good EF question. The question was how to split a model or how create a model for a large database. I pointed that colleague for the next three good resources which deal with such situations: Working With Large Models In Entity Framework – Part 1 Working With...

Back to Basics – How to Invoke Web Methods from a Remote Machine

November 8, 2009

Back to Basics – How to Invoke Web Methods from a Remote Machine I’ve been asked today how to enable invocation of WebMethods of an asmx web service from a remote machine for testing. The post holds the answer. How to Invoke Web Methods from a Remote Machine? Sometimes we want to test our asmx web service not from localhost but from a remote machine. Trying to open the test form of the web service from a remote machine will show the following message: “The test form is only available for requests from the local machine”. In order to enable the...