When using LINQ to Entities the LINQ expression is converted to a SQL query to be sent to the database. This is so that the whole table is not pulled into memory.
Your problem is that because Active is not mapped the database knows nothing about it and therefore cannot make the calculation.
You will either need to move Active into your DB or change the LINQ statement to only query on columns that are in your DB
- Calculated field in model class gives exception
- C# Ef Core Linq Query adding a calculated field to existing query results without using model
- Refactor model bound controller code to a class
- Is there a good source that gives an overview of linq optimizations?
- LINQ Source Code Available
- .NET 4 Code Contracts: "requires unproven: source != null"
- Access Violation Exception during access of field of Object
- Search query gives LINQ to SQL exception
- Exception in System.Data.Entity.dll but was not handled in user code
- How do I represent an option calculated column with EF Code First?
- creating Linq to sqlite dbml from DbLinq source code
- Entity framework calculated field by Expression<Func<T,V>>
- How can i copy data table records of different field name based on mapping list evaluating condition on source data table?
- Casting linq to model class fails "Unable to cast object of type 'System.Data.Entity.Infrastructure.DbQuery`1"
- Linq select query that uses prior property in calculated field
- Linq help - sub query gives null pointer exception
- entity exception was unhandled by user code
- Create a class type in code in .net c#
- Entity Framework Core - Sorting on Calculated Field
- C# linq xml missing element gives throws exception
- Convert a Model Class Collection to Dictionary based on property as KEY using LINQ C#
- Net Core: Find Data Type for any Variable Field in Class
- An exception of type 'System.ArgumentException' occurred in EntityFramework.dll but was not handled in user code
- Object reference not set to an instance of an object model fk and virtual field
- ProtoBuf-Linq error message “ Invalid field in source data: 0”
- LINQ - Group by calculated field
- EF Code First Insert Objects with One to Many gives exception."Store update, insert, or delete statement affected an unexpected number of rows (0)."
- Where clause on field outside Lambda expression class in Linq
- LINQ entity data model generated code error - The type 'DBContexts.Category' already contains a definition for 'ID'
- Null reference exception in my LINQ to XML code
More Query from same tag
- Select IN LINQ to entities with inner joins
- IQueryable for Anonymous Types
- Immediate execution with EF
- Use LINQ to compare the two lists
- When running a complicated line query in entity framework, where does the query run?
- How use Long type for Skip in Linq
- From Linq To List Using Extension Method
- Convert an IEnumerable<Ienumerable<T>> to Dictionary<key,IEnumerable<T>>
- Order LINQ query elements by a collection of numbers
- How do I use Linq to group a DataTable by multiple rows/columns into a new datatable with duplicate rows concatenated?
- Save LINQ Query As Variable To Call Another LINQ Query
- Can't add/sum string values in IEnumerable
- Linq query to fill a list in a nested class receiving an error
- How to Join in LINQ using Lambda expressions and get the result in DTO?
- How do I convert from entity/property names (conceptual) to table/column names (store)? (Trial code [in VB 2010 and EF 4] uses reflection.)
- SubSonic3 Linq query generates "IS NOT NULL" instead of "IS NULL"
- Mapping complex object to dictionary using LINQ
- CosmosDb LINQ query 'any' does not work but 'count() > 0' does?
- What instantiate-able types implementing IQueryable<T> are available in .Net 4.0?
- Return elements of the input sequence of a linq sum
- Selecting a value of a column in LINQ TO SQL
- c# List<T> calculate sum and average each item with the previous ones
- List of assignment expressions
- Linq Where list Contains item in another list
- Replace LINQ method with inline LINQ expression
- How to find duplicate dates in a list and group the description
- C# How do I replace objects in one collection with Objects from another collection
- LINQ instead of nested foreach and if
- No property or field 'OrderID' exists in type 'XElement' (at index 0)
- Nested conditional operator in a LINQ query