Ok, this is not a request for lazy loading or eager loading. I simply can't load the data I should.
I am using "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final"
public class Property
{
public int Id { get; set; }
public int PropertyTypeId { get; set; }
public PropertyType PropertyType { get; set; }
}
public class PropertyType
{
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Id { get; set; }
public virtual ICollection<Property> Properties { get; set; }
}
If I do
var properties = from x in _context.Properties
select x;
return properties;
propertyType is null. (Should it not be eager loaded since I didn't use virtual?)
If I do
return properties.Include(p => p.PropertyType);
I get first property with the propertyType. However, within the propertyType, there is an empty properties array which causes an infinite loop for the rest of the properties to show.
The workaround I can do is to add Newtonsoft.Json.ReferenceLoopHandling.Ignore. But this is just a one-to-many relationship. It shouldn't need it, right?
Ok, this is not a request for lazy loading or eager loading. I simply can't load the data I should.
I am using "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final"
If I do
propertyType is null. (Should it not be eager loaded since I didn't use virtual?)
If I do
I get first property with the propertyType. However, within the propertyType, there is an empty properties array which causes an infinite loop for the rest of the properties to show.
The workaround I can do is to add Newtonsoft.Json.ReferenceLoopHandling.Ignore. But this is just a one-to-many relationship. It shouldn't need it, right?