score:-1
i suspect your relationship is not 1 to 1.
score:0
since you did an .include("users")
you should be able to just traverse the user
property in the message
object to get the information your want.
score:2
you forgot to include the declaration of your "message" class but i suspect that the userid property in that class is not declared as a nullable type. if that is the case, change it from "int" to "int?" (nullable int).
Source: stackoverflow.com
Related Query
- Avoiding repeated projection code in Entity Framework
- Nullable entity projection in Entity Framework
- Entity Framework 6 Code First Custom Functions
- Entity framework `AsNoTracking` is not working with anonymous projection
- Forcing Entity Framework to not generate NCLOB's when building Linq-to-Sql Code (Model First)
- Entity Framework projection behaviour
- Entity Framework Code First without app.config
- Entity Framework Code First using context in Controller
- Entity Framework - LINQ statement with WHERE clause based on NULLABLE parameter
- many to many mapping in entity framework code first
- How to Create a Run-Time Computed (NotMapped) Value in Entity Framework Code First
- Entity Framework - Linq - Comparing Nullable objects - NotSupportedException
- Entity Framework LINQ projection into custom type results in missing data
- updating data in many-to-many relationship in entity framework in code first existing database
- Entity Framework Code First String Comparison with Oracle Db
- SQL subquery result in LINQ and Entity Framework Code First
- most efficient Entity Framework Code First method of flattening / projecting parent entity with specific child
- Entity Framework Code First - Get blog posts which have certain tags
- How to efficiently fetch distant relation in Entity Framework projection
- Entity framework not inserting values into nullable datetime field
- How to Query Icollections of Entity Framework Code First Data
- Entity Framework code first - Many to Many - Include conditional
- LINQ Projection in Entity Framework
- Entity Framework 6.1.3: Projection - load children of children directly
- Entity framework - select nullable join property
- Entity Framework Group by based on a Nullable Primary Key column
- Entity Framework Code First ToList method timing out on SQL Azure
- Entity Framework Insert In Code
- How can Entity Framework be forced to generate a SQL Inner Join on a nullable Foreign Key?
- How to make a property unique in Entity Framework Code First
More Query from same tag
- Linq to entities prob after update to MVC5
- C# How to cast List<object[]> into List<customClass>
- Assign foreach IEnumerable<string> to Object.StringId using Linq
- How to create an anonymous type within linq query with TypeScript
- Checking if two lists of objects are equal
- Get only parent class data entity framework
- Linq DataTable reuse concatenated variable
- querying Atom namespace using Linq
- Linq mix extension and query syntax
- Creating custom DTO class results in duplicate JSON properties
- Get Earliest date from from IEnumerable<DateTime>
- Entity framework navigation property is null
- How to define inheritance relationship in LINQ Entity Framework Core
- How to use .Contains in LINQ using C#
- Odd Linq behavior with IList / IEnumerable
- Sorting a list based on a condition placed on property of its inner list
- COUNT(1) OVER () with Linq to Sql
- Getting error:The entity or complex type cannot be constructed in a LINQ to Entities query
- C# List of different object types: Better way than Zip to check equality
- Why do I need LINQ if I use NHibernate-like ORMs?
- 'Invalid column name [ColumnName]' on a nested linq query
- Joining Xs, Ys into Points with Linq
- Combine different queries
- Is there a better way to code this Duplicate ID Checker?
- How to make two Joins generate one select?
- Dynamic LINQ with Data Objects
- Changing collection inside foreach
- Applying System.Linq.Expression to a List<T>
- Efficient way to convert flat data into nested group in C#
- Linq query on DataTable