I stored a bunch of objects of various classes that inherited from the abstract class Creative
. I wanted to see what was stored so I wrote a method like so:
public void GetCreativeTypes()
{
var types = from Creative c in original.AsQueryable<Creative>()
select string.Format("{0}: {1}", c.CreativeType, c.GetType());
foreach (var type in types.Distinct())
{
Debug.WriteLine(type);
}
return;
}
...but this returns no results. I have also tried:
public void GetCreativeTypes()
{
var types = from Creative c in original
select string.Format("{0}: {1}", c.CreativeType, c.GetType());
foreach (var type in types.Distinct())
{
Debug.WriteLine(type);
}
return;
}
with the same results. How can I get the results I want?
Objects in original collection would be like
public class ImageCreative : Creative{}
public class FlashCreative : Creative{}
...etc.
It turned out to be unrelated to the query. The documentation stated that the records did not need to be committed (just close the container), but once I committed them they were queryable. That was a headscratcher for me.