Domanda

FxCop analysed the auto-generated code in edmx files...

This bug is already known: Mircosoft Connect.

The only solution proposed there is from 2010 Customizing the Entity Framework T4 Template, suppressing code analysis.

Do you know some better solution or workaround for this problem?

È stato utile?

Soluzione

You could try using the DbContext templates instead of ObjectContext.

More info:

DbContext was introduced in EF 4.1 as part of Code First and since EF5 has also become the default generated context for Db/Model-first approaches. It uses POCO entities and simplifies a lot of common tasks, which I find makes my model easier to maintain. It also wraps ObjectContext, so you can still call into that if you need to. Since it generates different code, you'd be avoiding the FxCop warnings you are currently seeing, but of course switching to DbContext would require changes to your application code.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top