There is an old post by David DeWinter which shows how to see the proxy code generated by EF. The information is a little bit outdated or at least, there is no information on how to do the same for Code First approach.
The problem stems from the fact that David uses the CreateProxyTypes method which is not available on the DbContext class.
There are two possible approaches to get the same result (an assembly containing all your proxy types) for Code First’s DbContext.
An easiest approach is to switch the AssemblyBuilderAccess strategy just before you access any of your data. Then execute a linq statement on one of your DbSets and the proxy will automatically be created and thus – it can be persisted.
This method has one disadvantage – the persisted assembly doesn’t contain all possible proxies but rather – only these proxies that have been created so far (OneOfYourDbSets in the above snippet).
A difficult approach is to get deeply under the hood of the DbContext and fix David’s code to still work for this scenario:
In both cases, the generated assembly can be inspected with any IlSpy-like tool.