I'm trying to get the entity framework working in medium trust. I've tried splitting the files and using a separate assembly but I seem to have one problem after another.
I moved the EDMX to a separate assembly, which causes a single .dll to be outpit to the sites /Bin directory. I'm referencing this as below from web.config.
<add name="ApplicationDB" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Application.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
<add name="ShopEntities" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Application.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
Whenever I try to access one of the entity classes, I get an ArgumentException: 'An item with the same key has already been added.' It's critical this works with medium trust, but I seem to be running out of options. Any advice greatly appreciated.