Jun 29, 2012 at 9:23 AM
Edited Jun 29, 2012 at 9:26 AM
I have some hierarchical information that I need to store; a Company which has many Logos, many Users and each User has some Addresses.
I thought it best to put this information into an external database but am running in to quite a few problems accessing it which makes me thing I am going about it the wrong way.
Problem 1. I got an "The operation is not valid for the state of the transaction." exception when I tired to access the data. I got around this by wrapping the access code in a 'using (new TransactionScope(TransactionScopeOption.Suppress))' block.
Problem 2. Due to lazy loading, when I tried to access the entity model in my view, I still got the exception. Disabling lazy loading didn't work so I had to do something like this: address.AddressId = address.AddressId; just after my Where() method to work
around the issue.
Problem 3. I get the same exception again when I try and update the model and suppressing the transaction scope doesn't seem to help.
I'm just wondering if I am going about this the wrong way, maybe I should store my data in content items instead? If anyone can suggest a solution to any of the problems or a better way of storing the data, it'd be greatly appreciated.