Abstract Property / Polymorphismus
See original GitHub issueHello,
I have an abstract Property in my Row-Projection e. g.
abstract class AbstractArticleData
{
public int ArticleId {get;set;}
}
class Article {
public int ArticleId {get;set;}
public AbstractArticleData SpecialData {get;set;}
}
class ArticleData : AbstractArticleData {
// Other Properties
}
There is a “double” projection, first I project ArticleRow
to Article
, then I Project new { Article, ArticleData }
to Article
again.
At this moment I can’t provide a testcase, but I think Linq2DB can’t handle abstract Data types in genereal, because he wants to instantiate AbstractArticleData which results in a System.Linq Exception.
Any Ideas how I can extend Linq2DB to instantiate the correct data type (ArticleData
)?
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Understanding Polymorphism using Abstract Classes in C# ...
With polymorphism, you can define a single abstract class and reshape it in different ways to suit your methods & ideas.
Read more >Polymorphism Using Abstract Classes and Interfaces
In this article, you'll learn how to share and enforce code with polymorphism using abstract classes and interfaces.
Read more >Inheritance, Polymorphism, and Abstract Classes
An abstract class exists only to express the common properties of all its subclasses. A class that is not abstract is said to...
Read more >JAXB Inheritance: Polymorphism and Abstract Classes
An abstract class is a class that cannot be instantiated, but can be used as a superclass for other classes. It can have...
Read more >Object-Oriented Programming in Python: data abstraction ...
abstractmethod() may be used to declare abstract methods for properties and descriptors. Polymorphism is an important feature of class definition in Python ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Fruchuxs, sorry not yet. Will handle this next week, currently i’m too busy with main work.
@Fruchuxs, i see looks like you don’t need inheriatance mapping, but just want to easy switch between options which ancestor needs to be intstantiated. There is no option for now, but can be emulated by inheritance mapping.
Inheriatnce mapping is trying to instantiate different classes from the same table based on value of Discriminator Column.
Will try to find solution for you later.