In [a previous posting], I was set on the path to having to clone my entities. This I\'ve attempted to do with a serialisation approach as found in [codeproject].
b
I had the same issue using Entity Framework 6 ( EF6 ). I fixed the issue by changing the T4 template and adding the line [Serializable] between the Using Directives and the Entity Class Opening line. Like so:
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
[Serializable]
<#=codeStringGenerator.EntityClassOpening(entity)#>
No other changes required.