Session management with NHibernate and Autofac: Corollary
2009-08-21

Ooops, I forgot to mention that it's easily mockable as well. public class UserService : IUserService { public UserService(ISessionFactory factory, UsersRepositoryFactory usersFactory) { ... } } So that's the basic thing right. So now, with Moq, we can do this: var mockUserRepo = new Mock<IUsersRepository>(); mockUserRepo.Setup(x => x.GetUser(It.IsAny<string>())).Returns(() => someUser); var userService = new UserService(..., x = mockUserRepo.Object); So what I've basically done is insert a lambda expression into the constructor, which is the delegate, which always returns my mock repository. Read on...
Session management with NHibernate and Autofac
2009-08-20

NHibernate is a beast let me tell you! I think I already mentioned this in the previous post, but NHibernate definitely has a VERY high learning curve. If it wasn't for FluentNHibernate I'd probably still be struggling with XML mapping files right now. But anywho, it didn't take long for me to run into very many problems with NHibernate. It's not really NHibernate's fault, but more of maybe I'm trying to use the wrong tool for the job. Read on...
Goodbye db4o, Hello ORM
2009-08-18

It’s unfortunate that I have to remove db4o from my project, but I can’t say this was unexpected. The CTO finally came to me today to voice his concerns on using an object database rather than a relational database. As typical of many organizations, we have a database team dedicated to maintaining the integrity and performance of our main product. We are also stored procedure happy and every write and read operation goes through a stored procedure….so you can say I was pretty gutsy to even consider using an object database ;-) It was fun nonetheless… Sooooo….which ORM to use? Read on...
DDD, TDD, Enterprise Library, Autofac, and Lokad.Shared libs!
2009-08-15

So my project has been chuggin along quite nicely, and gave my CTO a quick look over the design of my project of which he was very impressed...I'm glad I spent all that time reading up on DDD, BDD, TDD, and listening to all the ALT.NET podcasts. I've learned SOOOOO much in the past month it is ridiculous, mostly thanks to coming across ALT.NET, and then reading everything linked from that source. Read on...
Dynamic proxies
2009-08-08

Life has sure been a roller coaster lately ever since I started working on my new project. I’ve learned a lot about WCF in the past week. There’s really nothing that can teach you faster than trying something out yourself. I’ve joined the ranks of countless others who have had to deal with implementing service behaviors to handle WCF exceptions (because by default thrown exceptions fault the communication channel), realized that WCF proxy clients breaks the ‘using’ keyword because someone thought it was a good idea to throw exceptions in Dispose(), and even Unity’s InterfaceInterceptor not supporting more than 1 interface! Read on...