I started off a few days ago thinking that I could write a simple toolkit for locking (restricting access to) and unlocking resources in our application. So for example by opening a project it would get locked to that user in some way, then when the next person came to open it they would not be able to modify it. Or an operation needs to write to certain files and read from certain files, so it locks them (in some metadata record in the database) as such before performing the operation.
Now that I've done a fair bit of design it is becoming apparent that there are actually quite a lot of little gotchas: I'm now in a situation where to describe the functionality I need I have 5 different types of lock defined (owner, write, read-only, delete, no-delete) and need to specify the relationships between them in the context of being applied to the same object and parent-child hierarchies.
That will translate into a fair amount code to maintain and testing and given this I'm wondering if there are any free .NET libraries available that do this sort of thing out of the box (I'm off on Christmas hols next week and I think it would be easier for one of the other devs to plug in a library rather than finish off my tooklit and plug it into the application).
We're using C# .NET and SQL Server 2008 R2.
UPDATE: By resources I mean files referenced by metadata in a database.