Hi, would you please provide a sample with polymorphism ? i have tried the result is not as it should be .
issue 1: when i insert a customer, the _t type is always person when it should be both "person, customer"
issue 2: i also should be able to use the IRepository to find ,insert or update any customer or employee ...
it simply does not happen ... any idea why ?
here is what i did
1 - created a base class that inherits from MongoEntity. added attributes
' [BsonDiscriminator(Required = true, RootClass = true)]
[BsonKnownTypes(
typeof(Customer),
typeof(employee),
)]
[CollectionName("person")]
public class Person: MongoEntity
{
... properties
}
[BsonDiscriminator("customer", Required = true, RootClass = false)]
public class Customer : Person{
... properties
}
[BsonDiscriminator("employee", Required = true, RootClass = false)]
public class Employee : Person{
... properties
}'
Hi, would you please provide a sample with polymorphism ? i have tried the result is not as it should be . issue 1: when i insert a customer, the _t type is always person when it should be both "person, customer" issue 2: i also should be able to use the IRepository to find ,insert or update any customer or employee ...
it simply does not happen ... any idea why ?
here is what i did 1 - created a base class that inherits from MongoEntity. added attributes
' [BsonDiscriminator(Required = true, RootClass = true)] [BsonKnownTypes( typeof(Customer), typeof(employee), )] [CollectionName("person")] public class Person: MongoEntity { ... properties }
[BsonDiscriminator("customer", Required = true, RootClass = false)] public class Customer : Person{ ... properties }
[BsonDiscriminator("employee", Required = true, RootClass = false)] public class Employee : Person{ ... properties }'