score:2
Accepted answer
have a look at implementing the unit of work pattern so that you can share a context instance across repositories.
there are many examples on the web, e.g. http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application
Source: stackoverflow.com
Related Query
- Error LINQ expression contains references to queries that are associated with different contexts
- The specified LINQ expression contains references to queries that are associated with different contexts error in c#
- Linq Lambda Error : The specified LINQ expression contains references to queries that are associated with different contexts
- Error: "The specified LINQ expression contains references to queries that are associated with different contexts"
- The LINQ expression contains references to queries that are associated with different contexts
- LINQ expression that contains references to queries that are associated with different contexts
- What is meant by 'The specified LINQ expression contains references to queries that are associated with different contexts'
- Union two models together causes "The specified LINQ expression contains references to queries that are associated with different contexts."
- Error: the specified linq expression contains references to queries that are associated with different context
- How are people unit testing code that uses Linq to SQL
- C# linq expression in lambda with contains
- linq how to select a parent with a child collection that contains one or many of an array (or list) of values
- Using a LINQ ExpressionVisitor to replace primitive parameters with property references in a lambda expression
- Create a Linq Expression with StartsWith, EndsWith and Contains passing a Expression<Func<T, string>>
- Expression to get LINQ with Contains to EF for SQL IN() where on entities child's property equals value
- Is there a JS library that supports writing linq to sql queries with nodejs?
- Determine, that sequence contains other sequence, in same order, with using LINQ
- LINQ query with two joins that worked in EF 6 gives error in EF 7
- C# Code Contracts -- How to ensure that a collection of items contains items with unique properties?
- linq - how do you do a query for items in one query source that are not in another one?
- Fluent LINQ - Select a list of parents that contains a list of children where a subset of children are present
- Build Any() with Expression Trees for LINQ Queries
- Linq SQL error with one-to-many relationship and orderby complex expression
- Is it possible to prove (programmatically) that two LINQ queries are equal?
- Using Expression Class With LINQ Queries
- How can I select using LINQ for an entry that contains a LIST with more than one row?
- Queries with local collections are not supported LINQ
- Linq to SQL Expression Properties That are Translatable to SQL
- LINQ for removing elements that are started with other element from list
- I am using linq and I am getting the error "There is already an open datareader associated with this command which must be closed first"
More Query from same tag
- Unable to get logic for related tables
- Split a long string to a customized string
- How to build nested treeview in C#?
- .net Databinding - Referencing Anonymous Type Properties
- How to pass predicate to linq expression
- LINQ performing multiple queries instead of a single "joined" query
- Create a hierarchical JSON Http response structure using LinQ
- Select whole first table, and overwrite one column with joined table
- How would I add type specific implementations to linq binary expressions?
- Clear particular column values in DataTable
- Like search for datetime fields using dynamic lambda expression
- Include many to one records in LINQ
- DataContext to DB
- Why isn't this Linq query on Dictionary<TKey, TValue> working as DataSource
- EF linq/lambda .contains(list[String])?
- How to perform addition to number rather than appending to end in Linq
- Order by a date inside of a foreach razor
- nvarchar(max) field is empty when I insert ~81192 characters in it on SQL Server
- linq convertall for multiple field
- Encapsulation and use of LINQ logic in functions using dot notation
- LINQ XML Subquery - Need Assistance
- I'm trying to simplify with linq a statement that takes 2 lists of numbers and subtracts the first one from the second one
- Trying to use getfilenamewithextension in LINQ and C#
- How can I insert all rows from one table into another table with Linq-to-SQL?
- Most efficient way to compare an Entity Model to a DTO Model in C#/LINQ
- How do I query a DataTable using Linq with my criteria in a list?
- Is this the correct way to return this data using LINQ
- LInq Order By and Order By Desc
- Exclude collection for removal, Linq
- How can I find an entity based on it's ID in a DBSet<>?