views:

115

answers:

1

I'm trying to design/implement a reputation system for a website i'm coding with ASP MVC + entity framework and was wondering if it would be a good idea to write all the logic for the reputation system into StoredProcs insted of doing coding it into the application model.

Personally i try to avoid using stored procedures as much as i can, but for this case i see them as the best option, loading all the entities just to increase the value of 2 fields seems pretty much an overkill, especially if the call is going to be made through ajax.

What's the general opinion about this? Anything i should take into consideration? where is implemented in stackoverflow (DB level or .Net level)?

Would be a better option to use triggers instead of sprocs?

+1  A: 

Why would you need to load all the entities? Isn't the reputation centrally stored for each user?

Wouldn't it just be one load and one update?

There are also the possibility to run a query from within .net space like this: http://msdn.microsoft.com/en-us/library/bb738521.aspx

Personally I would use the ORM as far as I could, and then fallback to SPROCs if I found there was a performance problem.

asgerhallas
with "loading all entities" i was trying to say that i actually have to load some entites that i wouldn't need to load with a simple "update table set value = value + 1".
Drevak