New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InheritanceMappingAttribute is working incorrectly when abstract class is present in inheritance tree #4460
Comments
@MaceWindu Were you able to reproduce this? Is that a bug or am I missing something? |
I would suspect mapped types inheritance doesn't work from your description. Current Inheritance mapping implementation needs serious rework and till it is not done I would recommend to not inherit from mapped type. |
@MaceWindu I've investigated the problem further and actually there are two separate issues here:
|
@MaceWindu Another aspect where inheritance mapping is broken: when two child classes have property with same name (mapped to columns with different names) - only first one is created by
|
@MaceWindu another broken aspect -
|
@MaceWindu another broken aspect - some boolean variable equals true in WHERE:
When
P. S. I post all these "another broken aspects" not to bother you but for future test when InheritanceMapping will be fixed at last. |
Describe your issue
I have a base class, it's child and a grandchild (it inherits from a child through an abstract class). Base class, child and grandchild are saved into same database table (I use
InheritanceMappingAttribute
and discriminator column). For a child it's working ok, but for grandchild discriminator code of a child ("Child"
) is inserted. The very same code was working correctly ("GrandChild"
was inserted) via Linq to SQL DataContext (it wasSystem.Data.Linq
namespace instead ofLinqToDB
):Steps to reproduce
Generated SQL for inserting a grandchild:
P. S. Is it ok that for
db.GetTable<Child>()
LinqToDB generatesWHERE ([t1].[Code] <> 'GrandChild' OR [t1].[Code] IS NULL)
clause? Fordb.GetTable<GrandChild>()
it generatesWHERE ([t1].[Code] = 'GrandChild')
clause and it's definitelly expected.Environment details
Linq To DB
version: 5.4.0Database (with version): SQL Server Compact 4.0
ADO.NET Provider (with version): linq2db.SqlCe 5.4.0
Operating system: Windows 10 22H2
.NET Version: .Net Framework 4.7.2
The text was updated successfully, but these errors were encountered: