Archive for December, 2007

h1

Hello world!

December 24, 2007

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Advertisements
h1

My day at work…

December 17, 2007

Yesterday at work I did two really cool things.
1) I had a live one note session with my colleague. It was a brain dump on what we should be testing in the project for our stabilization phase. See, as we reach christmas we decided to make the final week of the scrum sprint to be a stablization phase to make sure we weren’t starting off a sprint and leaving it half done over christmas.
I am really pleased with the session we had, it was extremely efficient beacuse we would see what each was writing then and there and would either say ‘Oh yes, good point I didn’t think of that!’ or ‘Hey, there’s no need to test that because I already implemented that fix’ or even ‘That scenario could be tested better by doing this’
This kind of rapid response/feedback I felt was worth a lot of time

2) We then went away and started wiring up the test harnesses. We are using visual stuidio unit tests and currently have no mockery architecture in place. We have about 20 unit tests so far and because they all touch the database it is starting to get slow to run the unit tests. I suspect the need for a mockery unit test solution will show its head shortly.

That’s all folks.

h1

LINQ Repository

December 11, 2007

Today I did some very fun refactoring at work. I am using a LINQ Repository interface with generics to get some free functionality.
Currently the project I’m working on at work is an asp.net 3.5 project and has 3 projects that make up the solution.
The first is a DB Pro project that has all the sql scripts inside it. The “middle” project is named core and it holds all the business and data layer logic, and lastly the asp.net project. In the core project I would have all my entities that are partial classes and call upon LINQ functionality for my CRUD operaions. And Lastly the asp.net project. From the asp.net project I would call upon the core project’s partial entity classes for my operations. For example.
I want to bind a product to my listview, so the code might look something like this.

ListView1.DataSource = Product.Get(productID);
ListView1.DataBind();

and within Product.Get(int ProductID) you may have something along the lines of:

return Product.SingleOrDefault(x => x.ID = ProductID);

Pretty standard stuff right. Now with the new “LINQ Repository” I would call

Repository.Get(productID);

and there wouldn’t be any code within the Product class other than

class Product : IRepository

and I would get all my CRUD operations for free!

Here is the code for an example of IRepository (Note, none of this code is compiled and tested, I am doing this in the blogger’s WYSIWYG)

public interface IRepository
where T : IIdentifiable
{
int Count();
int Count(Expression<func> expression);

void Add(T entity);
void Remove(T entity);
void Save(T entity);

T FindOne(int id);
T FindOne(Expression<func> expression);

bool TryFindOne(Expression<func> expression, out T entity);

IList FindAll();
IList FindAll(Expression<func> expression);

IQueryable Find();
IQueryable Find(int id);
IQueryable Find(Expression<func> expression);
}

h1

TFS

December 3, 2007

Today at work I realized that TFS has some basic functionality missing from the GUI.
In VSS you could undo someone elses checkouts easily by logging in as admin and right clicking -> undo checkout. This scenario might be useful in the event that a developer is sick or has quit and still has files exclusively checked out. Luckily there is a command to do this from comand line inteface: tf undo /workspace:workspacename /server:http://urltotfs:port /recursive “$/projectname”