engineertdog
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
Raw SQL Query Question
I have a raw SQL query that I need to execute against a database that's external to my application. The query is expected to return >5,000,000 records. Therefore, returning the records in memory (list) causes the application to crash due to running out of memory, even on a server with 122GB.
Is it possible to enumerate over the records instead, so that I don't have to deal with them all in memory?
19 replies
Publish .NET Framework App
When publishing a .NET Framework Console app, I get
setup.exe
, <app-name>.application
, and then the Application Files
folder with the information for that version.
1. How do I include another project (static files) in the output?
2. Do I only need to provide end-users with the setup.exe
, or do I need to give them all of the files from the latest version under Application Files
?1 replies