Recently I had been tasked with having to count the number of Pdf Filenames within a table. The challenge was that the column can have multiple filenames within a column separated by a commas. My solution was to create a case statement within the query for the count in a row column and then sum […]
Unit Testing / Mocking Techniques
Introduction to Unit Testing Unit Testing The primary goal of unit testing is to take the smallest piece of testable software in the application, isolate it from the remainder of the code, and determine whether it behaves exactly as you expect under various conditions. Benefits Unit testing has proven its value in that a large […]
How to automate trimming strings in Entity Framework
When working with legacy data where the data being loaded into SQL server tables contains trailing spaces, the trailing spaces will remain in the fields regardless of whether the fields are varchar This poses problems when doing compares or extracting data to files as you may not get the results you are looking for. One […]
NHibernate/DAO Unit testing
Unit Testing with using NHibernate and Data Access Objects [TestClass] public class AccountTest { private DATestHelper<CustomerDAO, CustomerDE> dh = new DATestHelper<CustomerDAO, CustomerDE>(); private DATestHelper<ProductDAO, ProductDE> dhProduct = new DATestHelper<ProductDAO, ProductDE>(); [TestInitialize()] public void TestInitialize() { dh.Init(); dhProduct.InitJoinSession(dh.session); } [TestCleanup()] public void TestCleanup() { dh.Cleanup(); dhProduct.CleanupJoinedSession(); } [TestMethod] public void GetAccountById() { CustomerDE c = dh.dao.FindById(1231); […]
Getting started with Ionic Framework
Ionic is a framework for developing hybrid mobile apps using modern web technologies. One of the benefits for creating mobile apps using ionic framework is you have one common code base. Ionic Command Line Reference start – starts a new Ionic project server – starts a local development server. It has a live reload feature – […]
Application Configuration Settings
One of the most common ways to store application setting is in the config file. Below I will show examples of how to store configurations and their retrieval. AppSettings and ConnectionString Sections Include the appSettings and/or connectionStrings sections in .config file for retrieval from your application. <?xml version=”1.0″ encoding=”utf-8″?> <configuration> <appSettings> <add key=”MySampleKey” value=”Sample value” /> […]
Personal Web Site hosting with Internet Information Services (IIS)
A lot of times working in development, you inherit code and never get the benefit of learning how things are configured and/or setup. You just follow the patterns that are already presented within the code base. But a while back, I worked with a developer who taught me the value of taking the time to […]
Entity Framework cloning
On a recent project, I had come across the need to copy an existing EF Entity. Upon my research, I found several ways to accomplish this task. One way is to create a new object and manually assign the property values using the existing object values. You can also use some kind of mapping utility if it […]
Global Data
Global data is accessible anywhere in a program. Using global data is riskier than using local data. Here are some common problems with using Global Data: Problems with Global Data Unexpected changes to global data. Since global data can be accessed anywhere, it can also be changed anywhere without the intent of doing so. Cannot concentrate on […]
ASP.NET WebForms vs MVC
ASP.NET Web Forms and MVC both have their pros and cons. Below I have them outlined. ASP.NET Web Forms Web Forms is a visual approach for web development using a drag-n-drop, event-driven model. Advantages Rapid Application Development (RAD) Feature-rich server controls Data binding Higher level of abstraction over a stateless web. Simulates statefulness with support […]