Problem retrieving .net System.Drawing.Color from LiteDB
See original GitHub issueHi,
LiteDB seems to be having problems retrieving these values. Extract of my poco class:
Public Property ContentStretch As SetupWindow.ContentStretchMode = SetupWindow.ContentStretchMode.Stretch
<Id(25, 10), Category("General"), DisplayName("Background Color"), Description("The window background colour. This can also include transparency.")>
Public Property BackgroundColor As Color = Color.Lime
<Id(30, 10), Category("General"), DisplayName("Window Type"), Description("Windowed of Fullscreen")>
Public Property WindowType As SetupWindow.WindowTypes = SetupWindow.WindowTypes.Windowed
<Id(35, 10), Category("General"), DisplayName("Topmost"), Description("Whether to place the window over all preceding windows")>
Public Property Topmost As Boolean = False
If I explore the LiteDB - the color values all seem stored correctly:
However, when I retrieve from LiteDB, all other values are retrieved correctly, apart from the color object (which seems to be default black):
I’d be grateful if you could advise as this one has me scratching my head!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How do I set up a Custom Type in LiteDb?
I am trying to serialize and deserialize a System.Drawing.Color property in LiteDb. ... LiteDb does not deal with Color natively(see here).
Read more >Object Mapping - LiteDB :: A .NET embedded NoSQL ...
The LiteDB mapper converts POCO classes documents. When you get a ILiteCollection<T> instance from LiteDatabase.GetCollection<T> , T will be your document ...
Read more >[C#] Can't use type System.Drawing.Color - Discussion
When trying to use System.Drawing.Color from the CitizenFx.Core namespace the compiler complains that the referenced assembly is not defined ...
Read more >[Solved]-LiteDB: Invalid BSON data type 'Null' on field '_id'-C#
I have a product class with a field columnId and I added another Id with type objectId to get rid of that Invalid...
Read more >Dynamic Type Description Framework for PropertyGrid
A framework that allows you to customize your class for PropertyGrid at design-time and/or run-time. Using this framework your can control ...
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 FreeTop 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
Top GitHub Comments
@stigzler You should try to register Color as custom type: https://github.com/mbdavid/LiteDB/wiki/Object-Mapping#register-a-custom-type
Given that this issue has been answered, I’ll be closing the ticket. Feel free to reopen the ticket if you think that your question hasn’t been fully resolved.