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); […]
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 […]