Csharp Code Samples

Rohan’s Blog – C# .NET Programming
  • rss
  • Home
  • About
  • Search
  • Contact Me

Nhibernate Parent Child Relations

Rohan Warang | August 1, 2009

For almost every Nhibernate beginner the most challenging thing to do is implement a parent child or one to many relation. There are many articles about this on the net some very basic and some highly detailed. But most samples available do not run when you download them giving all sorts of Nhibernate errors, which well obviously make no sense to someone who is using Nhibernate for the first time.

So this is my attempt at building a small Nhibernate one to many sample that will hopefully run without any issues and help in implementing basic relations using Nhibernate.

Read the rest of this entry »

Comments
3 Comments »
Categories
Tutorials
Tags
Nhibernate, Parent Child
Comments rss Comments rss
Trackback Trackback

Preventing SQL Injection Using Linq

Rohan Warang | May 10, 2009

SQL injection is one of the most common hacking methods for websites where authentication is required for accessing the website content. In this article we try to verify if linq based data access layers are truly immune to SQL injection.

Read the rest of this entry »

Comments
4 Comments »
Categories
Tutorials
Tags
Inline Query, Lambda Expression, Linq, SQL injection
Comments rss Comments rss
Trackback Trackback

Thread Synchronization: Ensuring Atomic Operations

Rohan Warang | April 7, 2009

An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure (Wikipedia).

In a threaded application certain variables or objects may be shared by multiple threads. If these variables are accessed by two or more threads at the same time it will produce unpredictable results. These operations cannot be termed as atomic.

This article describes how to ensure atomic operations in a multi-threaded environment.

Read the rest of this entry »

Comments
2 Comments »
Categories
Tutorials
Tags
Atomic, Lock, Threading
Comments rss Comments rss
Trackback Trackback

Thread Synchronization: Avoiding Race Conditions

Rohan Warang | April 5, 2009

Race conditions occur when two or more threads try to gain control of the same object. In a threaded application multiple instances of threads run concurrently. These threads may share some variables such as counters or some other global objects. There is every chance that multiple threads simultaneously try to write values to the same object. This is known as a race condition.

Read the rest of this entry »

Comments
1 Comment »
Categories
Tutorials
Tags
Race Condition, Synchronization, Threading, Wait Handles
Comments rss Comments rss
Trackback Trackback

« Previous Entries

Subscribe

dZone

Categories

  • Optimization
  • Tutorials

Admin

  • Log in
Creative Commons License rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox