engineertdog
Base Class architecture
I'm working on building a highly versatile base class that I intend to use in numerous applications and projects, so I'm trying to theorize the best way to build this class (see code attached).
Requirements:
- Quartz is the scheduling mechanism that will be used in the apps (and the base worker should be derived from that structure)
- In the UIs, users will be able to choose workflows (which are tied to specific applications) and be able to choose the source/destination (ie SDK->SQL or SQL->File, etc)
- The rest of configuration (stored in SQL) will be written to file, somewhere, that the apps will pick up through this Quartz worker.
For example:
- A user goes into the UI and selects that they want to pull connection statistics from Server A ("connection statistics" would be tied to a specific class that would inherit from the base, which defines the powershell/sdk/etc to extract or flush records in the correct format)
- The user chooses the server to pull the statistics from.
- The user chooses to write the output to file.
- The user chooses to execute the task now.
Or another example:
- A user goes into the UI and selects that they want to write data to Server B
- The user chooses the server to write data to
- The user chooses SQL as the source to select xx records
- The user chooses to write the output to the server itself (ie via SDK)
4 replies
Multipart form upload prepends the file
I have a 3rd party that I am uploading files to via C#. For some reason, it looks like C# is prepending the files with additional information prior to uploading them and I can't figure out where it is occurring.
Example prepend to CSV or JSON files
1 replies
Update configuration in memory
I have the class below where I'm trying to provide default values if a user doesn't configure them in
appsettings
. Supposedly, this is supposed to work, but it's not working in practices. Do you have any recommendations to either fix this, or to just use default values regardless and screw the config?
The purpose of doing this is to account for relative paths not being correct when running interactively vs as a service.80 replies
Uncaught exception
I have the following code as part of a class I'm building for impersonation. It works, but the UnauthorizedAccessException is being marked as unhandled. If I hit continue, it all works as expected. But why is it unhandled and how can I address that?
13 replies
✅ .net8 impersonate
This logs the current user and not the identity that's impersonated. I need to be able to execute certain tasks as users. Is this just not reasonable with net8?
Nevermind, the current identity lied. That was code taken from the MS docs website. If I do an action, then it does use that context. Misleading that the current identity isn't correct.
1 replies
✅ Content would exceed Content-Length
I have this code to add files to an
HttpClient
to send API requests to an external API.
The problem I have, is that I am getting the error Unable to write content to request stream; content would exceed Content-Length
. Now, in some cases, the automated Content-Length
value being set was incorrect. I have tried manually setting the content length with streamContent.Headers.ContentLength = fileStream.Length
and while this does correctly set the size, I still get the same error that it would exceed the length. I'm not sure why that's occurring.3 replies
EF6 Relationships
I have two classes built in EF Core, that I used to scaffold the database and use in the frontend Blazor app.
Now, building and using this in Blazor is fine. However, I also need the table in a .NET Framework app. So I've ported the DB model to EF6 just to simply use the context for accessing the database and the models without writing the queries manually. However, EF6 refuses to work with this due to the relationship. It throws an error for
Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '*'.
What solutions are there for getting around this? I have to use .NET Framework, and building an API is overhead that's just not needed.115 replies
Best way to model different options in EF Core
I have a class that's used to define the integration parameters for a particular process. Now, I have integration options A,B,C, etc each of which correspond to different tables with different IDs I need to populate on my class.
ex
Now, only 1 integration is supported for each instance of
myclass
. I could in theory define each available integration's FK references in this table, but there must be a better way to do this?
5 replies
C# executed in NodeJS
I have a 3rd party vendor SDK that's written in .NET Framework. They're working on a NET Core version, but I'd still like to look at the possible usage with NodeJS.
Are there any performance or other issues to worry about? The main reason I look to use the vendor's SDK instead of their API is performance between the technologies they offer, where the API is based on the SDK and is much slower to use.
10 replies
.HasPrincipalKey -> Specify different column name
I need to use
.HasPrincipalKey
in Fluent, but I need the resulting column to be named differently from what the Fluent API wants to use. I don't see an option to override the column name to something different?5 replies
FK on Guid
I have the following two classes
Where each database record will have it's own unique ID, but the relationship between the two records is based on name (due to pulling the data from a 3rd party system). However, this throws an error when attempting to migrate for
'PiCollectiveIdentityMapping.Mappings' with foreign key properties {'IdentityName' : string} cannot target the primary key {'Id' : Guid} because it is not compatible
What is the proper way to build the relationship?7 replies
Persist data between Quartz Execution
I need to be able to persist data between instance executions. I have to tie two separate jobs together through a common identifier. The approach below does not work. From my understanding, I will need to create a new schedule based off the old one in order to persist data?
1 replies
What version of PowerShell.Create() is created?
This throws an error, stating that $PSVersionTable is not a function. I have PowerShell 7 installed where the code is running, and I've verified the commands still work there. So what is the SDK creating behind the scenes that's not compatible?
24 replies
Send message from one app to another
What's the easiest method for sharing data between applications? MessageQueue looked promising, but it doesn't appear available in Core.
I need to be able to send data between different applications that are using both Core & Framework. So, Core<->Core, Core<->Framework communication. Can't use cloud services, although RabbitMQ could be used if there's nothing well supported natively or current on Nuget.
14 replies