Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Reopened Issue: Bug in Complex Type Discovery convention [943]

$
0
0
When the model below is evaluated, Address is treated as an Entity instead of being a complex type and an exception is thrown. This exception goes away and the model is properly evaluated when the complex type within the complex type (StreetInfo) is removed. Another note, If the [ComplexType] annotation is added to the Address class, then we can nest more complex types at least two layers deeper successfully without having to add another annotation.

Model:
public class Entity
{
public int ID { get; set; }
public Address Home { get; set; }

public Entity()
{
Home = new Address {City = "Redmond", State = "WA", Street = new StreetInfo {HouseNumber = 1, StreetName = "Microsoft Way"}, Zip = 98052};
}

public class Address
{
public StreetInfo Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public int Zip { get; set; }
}

public class StreetInfo
{
public int HouseNumber { get; set; }
public string StreetName { get; set; }
}
}


Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>