ObjectExporter icon indicating copy to clipboard operation
ObjectExporter copied to clipboard

Add option to ignore Entity Framework Proxy objects

Open OmarElabd opened this issue 10 years ago • 2 comments

EF generates child members with types of System.Data.Entity.DynamicProxies .Blog_5E43C6C196972BF0754973E48C9C941092D86818CD94005E9A759B70BF6E48E6, these properties have some change tracking properties for efficiency. This doesn't make for a pleasant type, so we'll ignore this derived object and use the parent object instead.

Will detect types with "System.Data.Entity.DynamicProxies" then use the parent.

OmarElabd avatar May 05 '15 15:05 OmarElabd

I'm trying to look into this matter (I really need this feature in my day to day work). But I'm stuck on getting transformedText = "\r\n"company": Internal error retrieving local value." in GenerateText in ExportGenerator.cs. I have tried to debug the templates but that is not getting me anywhere (I have never debugged T4 templates before). I can debug the other code just fine, only templates that are a problem.

Any ideas or hints on where / how I could fix this?

Sheffer avatar Dec 15 '16 17:12 Sheffer

Hey @Sheffer, I'm not sure what you mean by getting transformedText = "\r\n"company" could you post an example of the code you are trying to generate and what the object exporter generates?

If your issue is with Entity Framework specifically you can disable EF proxy generation through an option in your code.

see https://msdn.microsoft.com/en-us/library/jj592886(v=vs.113).aspx

But that would mean you need to manually specify what the objects to load and how deep (so you wouldn't be able to use any lazy loading and change tracking appropriately).

T4 templates are very not complicated to debug or understand. If you are not familiar with T4 it is just another template language (all they do is use inline code to generate text). If you do any sort of web development you've probably already familiar with templates such as aspx or razor pages.

OmarElabd avatar Dec 15 '16 18:12 OmarElabd