Use Virtual/Override properties to override column name
See original GitHub issueHi!
I’m trying to use override for properties but it doesn’t take it’s attributes. Is it supported?
public class BaseClass
{
[Column("Text base")]
public virtual string Text { get; set; }
}
public class ClildClass : BaseClass
{
[Column("Text new")]
public override string Text { get; set; }
}
public class Build
{
public BaseClass BuildNew()
{
return new ClildClass();
}
}
In the end I want to see ‘Text new’ but keep getting ‘Text base’
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
c# - Overriding fields or properties in subclasses
Use an abstract Property and override it on the inherited classes. This benefits from being enforced (you have to override it) and it...
Read more >Override a virtual function
In Class View, select the class. · In the Properties window, select the Overrides button. · If the function has no override, then...
Read more >Understanding virtual, override and new keyword in C#
Virtual and Override keyword are used for method overriding and new keyword is used for method hiding.
Read more >Why was C# made with "new" and "virtual+override ...
C# forces one to use virtual and new/override to consciously make those decisions. There are several reasons. One is performance.
Read more >Can I override properties of business objects?
Overridden properties use the same column and cannot modify their parameters. So, there is no point in applying attributes from the DevExpress.
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
IMHO the design creating an additional class is cleaner from an object-oriented POV (you could even make the base class abstract).
I’ve added the
Inherit
property in 5.2.405. Your original code would now become:Awesome 😃 Enjoying your library!
Somehow managed to find a workaround though