c# - Why aren't data repositories static? -


i looking @ repository method asp.net mvc app , noticed static class wasn't used. since repo crud, why not make static?

1) it's difficult unit testing static classes (if testing class depends on repository, want test work against fake 'mocked' repository object instead of real one)

2) want have 1 repository instance per-request make easier ensure uncommited changes 1 user don't mess things user.


Comments

Popular posts from this blog

how to build hyperlink for query string in php -

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

queue - mq_receive: message too long -