Moving

We moved. Actually, we bought a house. We weren’t planning on it. We weren’t saving for it. It was basically handed to us on a silver platter. Back in April or May we were discussing our current living arrangements. We were in an amazing apartment with no upstairs neighbors. The upstairs neighbors had moved out in April. They were quite noisy with an even noisier large dog that was afraid of being alone…

Since we’ve rented for quite a long time, that was our first idea. Let’s move out of the apartment and find a rental house to move into. We were getting frustrated with high rental prices, and the thought popped into my head one Saturday morning to see if there were any zero down financing options. Purchasing can be so much cheaper month to month, so we decided to step out in faith, ask the Lord to shut it down if it wasn’t what we were supposed to do, apply for a loan, and just wait to see what would happen. Lo and behold we were pre-approved! Let’s start shopping!

We got plugged in with a realtor that was mediocre. We weren’t crazy about him. The morning after we met him we went out on our own and checked out a place in Aubrey that was for sale by a company called Open Door. They have a pretty slick mobile app that can take your location and give you a door code for a private tour of nearby homes. OpenDoor purchases the homes so they are vacant when you tour. No working around homeowner schedules or dashing around trying to coordinate with a realtor. You can bring a realtor if you like, but it’s not necessary. Perfect.

We walked in and loved every bit of the layout, price, and location. OpenDoor called us later that day to discuss the process. It took maybe ten minutes. We made an offer the next day. It was accepted the day after. Talk about quick! Our house had been on the market for just over a month and we were the first and only offer which is just crazy in the DFW market. We went through inspection, contract, foundation inspection, etc. and at closing we were actually walking away with money. 😲

We paid our earnest money, inspection, and other fees, but we still came out with no money down and zero paid at closing because OpenDoor basically covered all of it. Unheard of.

So we moved. We moved out of our apartment into a home in Aubrey. It has all of the space that we need. It has all of the things that we wanted. It was such a gift from The Lord. It couldn’t have worked out better.

Dynamics & Inherited Interfaces

A coworker and I made an interesting discovery today. I was getting a SQL error back indicating that a method–one that was clearly available to my object–wasn’t being found. We’d run into this issue before and found a work around, but it wasn’t until today that we dug in figured out why it was happening.

We’re using Dapper as our ORM. We use these statements all the time.

_db.Execute(“SELECT TOP 1 FROM dbo.MyTable”);
_db.Query("UPDATE dbo.MyTable SET MyField = 'new value'");

Many times we pass in data as such:

_db.Execute(“SELECT TOP 1 FROM dbo.MyTable WHERE Id = @id”, new {id = 5});

In this case, 5 would be some strongly typed object or variable. Dapper does great with these. We created a wrapper for Dapper that gives us some extra functionality:

public interface ICoolDb : IDapperDatabase
{
void WithTransaction(Action action);
}

The above is just an example of something you could do for wrapping up a bunch of SQL statements in a transaction. No biggie, right? This is also where the issue lies. I only have one method available here. If I try to pass in a dynamic object to Execute or Query, the compiler doesn’t evaluate the available methods until runtime. When it does evaluate, it doesn’t pick up the inherited interface methods of Execute or Query from IDapperDatabase, so it throws an error. For some reason, the compiler doesn’t know to work up the inheritance tree to find those methods. #fail

_db.Execute(“SELECT TOP 1 FROM dbo.MyTable WHERE Id = @id”, new {id = 5});

This works because id is strongly typed as int. The fix that we came up with awhile back was this:

_coolDb.Execute(sql, account as object);

This casts our dynamic account object as object which makes everyone happy. I’m not sure if this same quirk applies to later versions of .NET, but we’re running 4.5 and it’s there. It’s annoying to add that as object bit in there each time I’m passing a dynamic, but I guess it’s the best we can do.