mercredi 26 août 2015

How can an Entity Framework model be like an enum?

Currently I have some code that looks like this:

IsAuthenticated(string userName, Groups.Accounting)

Groups is obviously a enumeration.

The problem is that Groups is also a table in a database that can have values added, changed, or removed. When the above line of code ultimately resolves it is looking in a database to see if the provided user name has access to data only members of the provided group can see.

This creates a situation where I have to change code to match a database. It's not something that happens very often... but it's always going to be a problem.

Is there a design pattern I should be following to help resolve this scenario?

Aucun commentaire:

Enregistrer un commentaire