The same error raised with another reason, this time, on the EntityFramework Code First.
I have a one-to-many model defined, so, in the parent model, it is something like this:
public class Parent{
public virtual ICollection<Child> Children;
}
If I return the IQueryable<Parent>, the "You must write an attribute...." is coming up again, while if I return the IQueryable<Child> it is fine. If I removed the
virtual, then parent can be returned, but EF cannot fill in the children (i.e., return [] for children property). Is that problem with the WebAPI as well?
gueei_com
Member
6 Points
3 Posts
Re: You must write an attribute 'type'='object' after writing the attribute with local name '__ty...
Mar 02, 2012 05:13 AM|LINK
I am so frustrated..
The same error raised with another reason, this time, on the EntityFramework Code First.
I have a one-to-many model defined, so, in the parent model, it is something like this:
public class Parent{
public virtual ICollection<Child> Children;
}
If I return the IQueryable<Parent>, the "You must write an attribute...." is coming up again, while if I return the IQueryable<Child> it is fine. If I removed the virtual, then parent can be returned, but EF cannot fill in the children (i.e., return [] for children property). Is that problem with the WebAPI as well?