I suspect your relationship is not 1 to 1.
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.
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).
- 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
- Get Specific Range of List Items (LINQ)
- How can I implement it by Linq?
- How to implement MaxOrDefault(x => x.SomeInt) LINQ extension?
- improving readiblity and be slightly less explicit using Linq
- How to search two tables in Database on linq?
- Entity Framework LINQ Multiple Column Count(Distinct)
- LINQ to SQL - select where text like string array
- Translate SQL query without FROM clause to LINQ
- is there something faster than Enumerable.Except<TSource> Method?
- Replacing a query in a foreach with a join statement
- Converting sql query to EF query- nested query in from
- how do I treat null lists like empty lists in linq?
- Unpassable Where Clauses LINQ-to-SQL
- Map two lists into a dictionary in C#
- Error: Cannot redefine the namespace for prefix '' used at current element
- LINQ - Result not null if querying a nonexistent element
- Linq query to select an item, with a parameter in a collection
- Conditions inside Select clause in Linq
- F1 season database individual races
- use for loop to iterate through Linq group result set