GtkSharp
GtkSharp copied to clipboard
Generic Host Builder
I'm currently working on implementing the Host Builder to facilitate logging, DI, Entity Framework, etc in a dotnet core standardized way. Is this something that should be considered for updating the templates to use as well? Or should it just stay Opt in as is currently?
With the template update and usage of dependency inject this could also involve updating the samples to utilize the full infrastructure of what host provides. It could lead to a cleaner implementation in the long run i think. That's just my opinion though. I'll introduce a PR to show exactly what I'm referring to though.
I have no idea what this is.
Basically using Microsoft's built in DI and Core services, just like any other dotnet Core application template. Work In Progress - https://github.com/Css-IanM/GtkSharp/blob/HostBuilder/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/Program.cs
So a paradigm, I wouldn't want to add something like this to the templates, they are there just for making a blank app, nothing more.
So maybe some content for the Wiki then? Something along the lines of a How To?
Sure.
Great idea, @Css-IanM . But why do you only use singletons in your example?
How console apps manages transient and scoped services?
I never used this di system but in general you would do it to get access to the main window (if there should only be one) from other points of your code
@knuxbbs You would use the scope/life cycle that applies to your requirements. I planned to update more to utilize sockets for subsequent views within the main window, a pseudo router if you will, hence singleton in the example.
I intend on creating a baseline Seed starter project based on this pattern, the above linked example was just a proof of concept. I will hopefully have some time for open source this weekend to get it going. I will link the repo here once its more fleshed out. While i'm working on that i'll be documenting the process so that i can organize and layout a wiki article for this repo. Hopefully this helps someone down the line.
@Css-IanM I've been tested your example and it's doesn't works.
Error message:
_gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
The example linked is an unfinished Work In Progress used to describe the issue before putting additional time. The paradigm however does work and I can help with a fully fledged example if you wish, time for open source is limited on my end.
Edit: your error listed above is familiar to me, though i cannot remember everything i did with initial testing. There was DI Container specifics and GTK depenendencies i had to register before any consuming classes. I have the working example at my office that works completely and I will push it up to the example for your reference.
@knuxbbs Here is an example repo with the full paradigm implemented. i think i also added sql server entity framework core to it as well, i just cant remember how far i actually took it.
Wow, thanks!
And a great 2020 to the GtkSharp community!
You can also take a look at this, I modeled the generic host extension copied by aspnetcore https://github.com/TheForgetTime/GtkSharp.Hosting.git
It contains an example using the sqlite entity framework core