Open
Description
When the new reflection code was plugged into the TableMapping Constructor it now iterates through inherited classes and builds up properties based off those objects as well as the derived class. (This was introduced in v1.3.2).
public TableMapping (Type type, CreateFlags createFlags = CreateFlags.None)
{
...
while (baseType != typeof (object)) {
(Get properties)
props.AddRange (newProps);
baseType = ti.BaseType;
}
...
}
If any of the properties are overridden in derived classes they are added to the list twice and therefore in CreateTable etc. it tries to add duplicate columns.
For example:
public abstract class BaseClass
{
public virtual int Id { get; set; }
}
public class DerivedClass : BaseClass
{
[PrimaryKey, AutoIncrement]
override public int Id { get; set; }
}
...
db.CreateTable<DerivedClass>();
...
throws an Exception for duplicate column Id when creating table. The same code works fine in v1.3.1 and earlier.
Not sure if the solution is just to skip properties that already exist when adding to your props list in the TableMapping Constructor?