I'm trying to understand what's going on with this line of code. It looks like this:
var adapter = (IObjectContextAdapter) db
where db
is a database context within the entity framework.
Firstly, why are the parenthesis on the interface? If I take them off I have a compile error, so that tells me there is some type of semantics at play and those parenthesis are telling the computer to do something.
I'm assuming that db is implementing the interface, am I correct? Why are they writing the code like this if that is the case?