Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Commit

Permalink
changed builder to assume that if the discriminator did not show up t…
Browse files Browse the repository at this point in the history
…hen the class is the base class.
  • Loading branch information
craiggwilson committed Jul 30, 2010
1 parent 62fc6e4 commit 8f7cde7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions examples/Simple/Main.cs
Expand Up @@ -81,6 +81,14 @@ public static void Main(string[] args)
collection.Save(circle);
collection.Save(sub);

var superclass = (from item in db.GetCollection<MyClass>("MyClass").Linq()
where item.Corners > 1
select item.Corners).ToList();

var subclass = (from item in db.GetCollection<SubClass>("MyClass").Linq()
where item.Ratio > 1
select item.Corners).ToList();

Console.WriteLine("Count by LINQ on typed collection: {0}", collection.Linq().Count(x => x.Corners > 1));
Console.WriteLine("Count by LINQ on typed collection2: {0}", db.GetCollection<SubClass>().Linq().Count(x => x.Corners > 1));
//Console.WriteLine("Count by LINQ on typed collection3: {0}", db.GetCollection<SubClass>().Count(new { Corners = Op.GreaterThan(1) }));
Expand Down
Expand Up @@ -38,7 +38,10 @@ public void AddProperty(string name, object value)
public object BuildObject()
{
if (_concreteEntityBuilder == null)
throw new Exception("Discriminator did not show up.");
{
//we'll assume that this is the root class in the hierarchy.
_concreteEntityBuilder = new ConcreteClassMapBuilder(_classMap);
}

return _concreteEntityBuilder.BuildObject();
}
Expand Down

0 comments on commit 8f7cde7

Please sign in to comment.