Rillian
Rillian
CC#
Created by Rillian on 7/17/2024 in #help
Help with EF Core polymorphic associations
Hi everyone, I'm currently at a IT job in a medical organisation. Through working with various software packages at scale I noticed two things. One was that the ability to add small amounts of plain text to various bits of data is very useful in unusual situations and quickly leads to the emergence of new workflows. And the second was that audit logs are invaluable. As I'm slowly getting to grips with EF Core (mainly used with ASP.NET) I've been trying to use polymorphic associations as a "silver bullet" for those kinds of things. The idea is that I have many different tables (users, tasks, requests, etc.) that can all have associated audit logs and comment sections. The tables containing the audit log events and comments would have two additional fields containing the type and primary key of the item they're associated with. E.g. one comment may be associated with ("request", 34) or a user locks themselves out and an entry is saved in the audit log referencing ("user", 21). As far as I understand my entities should include Discriminator fields but I haven't been able to find the information required to make it work. All relevant information I find seems to be based around an inheritance situation e.g. User and Contact inherit from Person instead of my use case with essentially replicates a regular many to one relationship. I'd also like it to support multiple inheritance so, for example, Page could inherit from AuditLog and Comments. Any advice on how to approach this would be much appreciated Thanks in advance
7 replies
CC#
Created by Rillian on 10/17/2023 in #help
❔ Please point me in the right direction. WPF + Windows Service app.
I'm quite new to C# but I already have a good bit of experience programming Python, JavaScript and a little C. I'm looking to rewrite a very small program we use in our organisation to perform backups of certain files on our shared drives. Our current program is a python app with a Tkinter GUI that saves it's config in a SQLite database. It's run headlessly in order to perform the backups. I'd like the new app to run as a windows service to perform the backups (It'd use dedicated credentials to access the UNC shares). Instead of using a central SQLite file I'd like the client to communicate with the service to get/set the configuration. Currently I'm looking at using. .NET 4.8. Not the most modern but supported everywhere and won't require too many additional dependencies. WPF for the GUI. See above. SQLite to store config and logging information that wouldn't seem appropriate for the Event Log, e.g. the full list of backed up files. An MSI installer Ideally I'd like to use the windows built-in RPC to communicate, similarly to how mmc does it. This would let me support connecting to local and remote PCs using windows authentication. Though I'd also be happy using gRPC locally with an AF_UNIX socket. Unfortunately I've had a lot of trouble locating tutorials and relevant documentation to the point that I'm wondering if I'm barking up the wrong tree. Any pointers in the right direction would be greatly appreciated. Also what little I did find, including the guides on how to create MSIs was very Visual Studio centric. I prefer to use VSCode when learning new languages for minimal hand-holding but I'm happy to use Visual Studio if required.
17 replies