I was just trying to do some extensive model first using the self tracking POCO approach. I do however not get it to work as I wish. Let's take a blog. Each blog has a set of Entries and each Entry has a set of Comments. Unfortunately the following Model does not work for me. alt text http://blog.zoolutions.se/issue.png
The POCO class implementation looks like the following:
public class Blog
{
public bool Id { get; private set; }
public string Title { get; set; }
public bool AllowComments { get; set; }
public User User { get; set; }
public IList<Entry> Entries { get; set; }
}
public abstract class Post
{
public virtual int Id { get; set; }
public virtual string Header { get; set; }
public virtual string Text { get; set; }
public virtual DateTime CreatedAt { get; set; }
public virtual int UserId { get; set; }
}
public class Entry : Post
{
public Blog Blog { get; set; }
public IList<Comment> Comments { get; set; }
}
public class Comment : Post
{
public Entry Entry { get; set; }
}
This gives me a very strange error:
System.Data.MetadataException: Schema specified is not valid. Errors: The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Entry'. Previously found CLR type 'Entry', newly found CLR type 'System.Collections.Generic.Dictionary
2+Entry'. The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Entry'. Previously found CLR type 'Entry', newly found CLR type 'System.Runtime.CompilerServices.ConditionalWeakTable
2+Entry'.
Any clues? I can't wrap my head around that error message...