seahood
seahood
CC#
Created by seahood on 1/13/2023 in #help
❔ ClickOnce install URL that uses query string parameters
Hey! I'm trying to deploy a NET6 WPF ClickOnce application to an Azure blob storage, my issue is, I want the installer to be only available for people who are authorised to access the storage. This is done with query string parameters on the URL (i.e. https://foo.blob.core.windows.net/bar?a=few&security=params). If i try to plug this URL into the ClickOnce publish profile, once I publish and attempt to run the application, it fails to install because it appears to construct the path to the application file wrong: https://foo.blob.core.windows.net/bar?a=few&security=params/My.application, with the querystring being treated as part of the main URL, instead of the correct URL: https://foo.blob.core.windows.net/bar/My.application?a=few&security=params Is there any way to resolve this? I feel like i've exhausted all avenues
2 replies
CC#
Created by seahood on 8/25/2022 in #help
Mapping outgoing enums to a specific shape in Asp.net Core [Answered]
Hello! I'm trying to find a way to take any outgoing enums in DTOs from an ASP.NET Core API, and map them into a specific shape before they head down the wire. I have an Enumeration class that's used by an existing mapper to map enum values to.
public class Enumeration
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
public class Enumeration
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
I'm using
services.AddControllers().AddJsonOptions(opts => { /* I guess some enum mapping converter should go here */ })
services.AddControllers().AddJsonOptions(opts => { /* I guess some enum mapping converter should go here */ })
I've tried looking at implementing a JsonConverter and it almost works, but falls down when it encounters a nullable enum. There's a built in JsonEnumStringConverter but that only maps the enum to it's corresponding string. Current output example from an API endpoint:
{
"someEnum": 0
}
{
"someEnum": 0
}
Expected output example:
{
"someEnum": {
"Id": 0,
"Name": "SomeEnum",
"Description": "SomeEnum"
}
}
{
"someEnum": {
"Id": 0,
"Name": "SomeEnum",
"Description": "SomeEnum"
}
}
I hope that makes sense? I think I need to find a way to handle the nullable enum situation (or there's an easier way and i'm just going about this all wrong). It's an annoying requirement of this API migration that i'm doing
8 replies