smsohan

Stories submitted by smsohan

Solution to JavaScript File Include Problem From ASP.Net MasterPage(smsohan.blogspot.com)

submitted by smsohansmsohan(60) 3 years, 5 months ago

You can include javascript files using a simple script tag. However, you will soon discover that, when you are using this master page from content pages that are at different levels in folder hierarchy then the script files will be missing at some cases. This is due to the fact that, script file paths are referenced relative to the content page and NOT to the master page. As a result, despite having the correct include wrt the master page, your content pages may still miss the scripts! read more...

add a comment |category: |Views: 13

tags: another

Set and Compile using C# Language Version 2.0 in Visual Studio 2008(smsohan.blogspot.com)

submitted by smsohansmsohan(60) 3 years, 8 months ago

In this small note I wrote how to compile a C# project using .Net version 2.0 and 3.0 in Visual Studio and targeting C# Version ISO-2 and ISO-1 instead of C# 3.0 read more...

add a comment |category: |Views: 45

tags: another

Unit Testing using Mocks - FillWithMocks, Fill all or only selected pr(smsohan.blogspot.com)

submitted by smsohansmsohan(60) 3 years, 9 months ago

I have been doing TDD for about two years now and using mock testing for interaction based unit testing in my projects. What I have learned over this time is, a unit testable design leads to introduction of interfaces and dependency injection for testing a code in isolation. And when I want to perform tests on my interactions, I need to create mock objects and inject these mock instances to my object under test. Sometimes, a unit test class needs to create quite a few of such mock objects and I feel this can be done using a simple wrapper around the usual mocking frameworks. I suggest a similar and even more powerful wrapper so that you don't need to create instances for each of the mock objects, rather do it in a single call for all your desired mocks. I have shown this method for NMock2, however, its evident that you can write your own method for your favorite mocking framework just using this code as a reference. read more...

add a comment |category: |Views: 5

tags: another

Comparing with NULL in where clause using Linq to SQL(smsohan.blogspot.com)

submitted by smsohansmsohan(60) 3 years, 9 months ago

In Linq to SQL, there is no 'IS' operator as SQL. And this IS operator is used for comparing a field's value to NULL in SQL where clause since two NULLs are not equal and using the regular '=' operator between two nulls evaluates to false. In this article, I have shown you the problem that you must know before you write Linq to SQL code in your application and also a work around to this problem. read more...

add a comment |category: |Views: 321

tags: another

Redirect LINQ to SQL DataContext Log Messages To Log4Net(codeproject.com)

submitted by smsohansmsohan(60) 3 years, 11 months ago

Visual Studio automatically generates the subclasses of DataContext class when dealing with LINQ to SQL for ORM. These auto generated classes have a property named Log of type System.IO.TextWriter. If an object of type TextWriter or its subclass is assigned to this property, then it will use that instance for writing the log messages. As Log4Net is one of the most used Logging libraries for .NET enterprise level projects, in this project I will present a solution to capture the log messages through Log4Net logging. read more...

add a comment |category: |Views: 99

tags: another

Change The Default CommandTimeout of LINQ DataContext(codeproject.com)

submitted by smsohansmsohan(60) 3 years, 11 months ago

At times, the execution of a LINQ to SQL query may take a longer time and exceed the default value of the DataContext class's CommandTimeout property. The following article will present a way to achieve an application-wide CommandTimeout for your DataContext class. read more...

add a comment |category: |Views: 387

tags: another

[ThreadStatic] - A cool Attribute to Thread Safe static members(smsohan.blogspot.com)

submitted by smsohansmsohan(60) 3 years, 11 months ago

If you need static members that are static only inside a single thread, this is the easiest solution to define thread safe static variables. read more...

add a comment |category: |Views: 39

tags: another