score:-1
I wonder what this would do
var old = (Foo)real;
I'm wondering if the instance itself is creating the connection
score:2
Your analysis is correct. Your assignments are establishing links.
You can modify the generated code to not do this (or write your own). But this means you have to live without auto-generated entity classes. I personally consider this to be unacceptable.
Why don't you serialize the pre-image object into a dictionary? Or copy its property values into a custom DTO class?
From your code I can tell that you want the old values to do change logging. You can do that using
DataContext.GetTable<T>().GetModifiedMembers(entity)
Source: stackoverflow.com
Related Articles
- Avoiding object saving in LINQ
- Avoiding code repetition when using LINQ
- LINQ Source Code Available
- Linq with where clause in many-to-many EF Code First object
- creating Linq to sqlite dbml from DbLinq source code
- Linq to sql as object data source - designer problem with partial classes
- Linq - list within object not saving on db.SaveChanges() call
- Avoiding duplicate code in Linq Select method
- Convert this LINQ code back to a Loop (or Why is this object sometimes null)
- convert linq to object query to sql query (no linq to sql code or datacontext)
- Avoiding repeating code with Linq query + optional params
- source code for LINQ 101 samples
- Linq code to get the index of an object in an array from an object within a list
- avoiding creating a new object with linq
- Create a tree structure in linq with a single list source with parent - child as strings of an object
- Check Nullable for object insde LinQ to Sql code
- c# Linq or code to extract groups from a single list of source data
- nullable object must have a value error in linq to sql in vb.net code
- How to use LINQ to select object with minimum or maximum property value
- Deserializing JSON to .NET object using Newtonsoft (or LINQ to JSON maybe?)
- Convert string[] to int[] in one line of code using LINQ
- LINQ Group By into a Dictionary Object
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- How can I get LINQ to return the object which has the max value for a given property?
- Create a list from two object lists with linq
- Linq code to select one item
- How to get first object out from List<Object> using Linq
- Return list of specific property of object using linq
- How are people unit testing code that uses Linq to SQL
- LINQ selection by type of an object
- LINQ to Entities (Entity Framework) Join and .Include conflict
- Using Linq for Object Dataset Processing
- multiple condition in entity framework
- nullable object must have a value error in linq to sql in vb.net code
- Order by null first and then in descending order
- c# copying existing XML document with Linq to XML
- Optimize a query or suggest LINQ equivalent
- Create a Groupedby HTML table using linq query
- C# Convert.ToDouble(value) in Lambda LINQ Statement
- Pass index to jQuery from LINQ (VB)
- Counting grouped data with Linq to Sql
- Linq Include just one object from a one to many relation
- How to convert two columns into a single string column with dynamic linq?
- System.OutOfMemoryException on Linq Joins
- C# Linq execute method over results from Distinct() method
- GroupBy using a list of strings
- How to call user defined function in LINQ in my visual C# web service for my android application?
- How to group by all employees with same manager in a list using c#?
- Grouping a flattened LINQ resultset
- How to get distinct value of Upper and lower case?