C#: Type Inference

Please see my other C# articles. Writing flexible, elegant code for data storage. When writing business logic, it’s often difficult to determine at design-time what type an object will need to be or what type of data it will store. Thankfully, Microsoft has provided an elegant solution by allowing developers to write code that will store any…

C#: LINQ – Query

Please see my other LINQ articles. Performing a simple query. Using Microsoft’s new elegant syntax or subset of the .NET framework that looks like it might be replacing ADO.NET, I will illustrate how to perform a simple query. This new syntax is much less bulky than executing the same query using ADO.NET commands. First, I’ll begin by…

C#: Generics

Please see my other C# articles. Ensuring type-safety in objects. Whenever performing domain modeling, it’s critical to ensure code matches the real-world environment as much as possible. The chief method for doing so to utilize classes by which objects may be instantiated. However, having a collection of objects that are either the incorrect type or contain incorrect…

C#: 4.0 Anonymous Types

Please see my other C# articles. Simple, elegant data storage. One of the latest improvements to the .NET Framework in 4.0 is the ability to use object initializers to create simple data-storage objects without having to create a class or struct. Also, these anonymously-typed objects are created by the compiler so you still have strong-typing on your…

C#: ADO.NET Transactions

Please see my other C# articles. Ensuring data-concurrency. When a feature requires an atomic action, ADO.NET transactions easily ensure data concurrency while performing writes against the database.For example, let’s say two separate db writes are needed, each of which executes a stored procedure.Should errors occur, it’s essential that both writes are rolled-back before any changes are…

T-SQL: Row_Number

Please see my other Database Development articles. Ranking Functions There are several new impressive advancements in the latest version of t-sql; this article will focus on “Ranking” functions. Prior to the release of SQL Server 2005 with its t-sql enhancements, working with blocks of related data was clunky at best. T-sql authors mostly relied on…

T-SQL: Synonym

Please see my other Database Development articles. Simplifying T-SQL syntax. Length T-SQL is unfortunately the byproduct of many business requirements in supporting an application. As the parts of each statement grows (database.schema.object), so the overall length of the entire query. Synonyms provide a painless method to drastically decrease code bloat in queries by allowing for…