I want to create an object that will work in a similar way to ASP.Net Session.
Say I call this object mySession, I want to make it so when you do
mySession["Username"] = "Gav"
It will either add it to a database table if it doesnt exist or update it if it does. I can write a method to do this but have no idea how to get it to fire when used with the indexer syntax ([]). I've never built an object that does anything like this with indexers.
Before anyone says anything I know the ASP.Net session can save to database but in this case I need a slightly simpler customized solution.
Any pointers or examples of using indexers in this way would be great.
Thanks