moritz
moritz
CC#
Created by moritz on 11/29/2023 in #help
Dapper enum to snake_case string
Hi, I have an enum ItemType with values like FileCollection. In the database a string is stored in snake_case form, eg. 'file_collection'. Dapper doesn't seem to map it automatically, even with DefaultTypeMap.MatchNamesWithUnderscores = true;. Anyone else had a problem like this before and can help?
3 replies
CC#
Created by moritz on 11/22/2022 in #help
❔ EF core large field slows the entire query down
I have some entities with some large json strings in them. The problem now is that they always get loaded, even if i don't use them. So my endpoint that is just supposed to return some basic information about like 50 objects now takes 300ms on average. Is there a way to mark a property as "not included with normal queries unless specifically requested"?
10 replies
CC#
Created by moritz on 11/14/2022 in #help
❔ one to zero or one relationship EFC
How can I model a 1:cn relationship in Entity Framework Core? E.g. An employee either has a supervisor or not
17 replies
CC#
Created by moritz on 9/27/2022 in #help
Jenkins unable to build CSharp project [Answered]
54 replies
CC#
Created by moritz on 9/8/2022 in #help
Blazor Dropdown bind to value
Is it possible to directly bind to an object instead of writing value converters?
Microsoft.AspNetCore.Components.Forms.InputSelect`1[BlazorApp1.Data.WeatherForecast] does not support the type 'BlazorApp1.Data.WeatherForecast'.
---> System.InvalidOperationException: The type 'BlazorApp1.Data.WeatherForecast' does not have an associated TypeConverter that supports conversion from a string. Apply 'TypeConverterAttribute' to the type to register a converter.
Microsoft.AspNetCore.Components.Forms.InputSelect`1[BlazorApp1.Data.WeatherForecast] does not support the type 'BlazorApp1.Data.WeatherForecast'.
---> System.InvalidOperationException: The type 'BlazorApp1.Data.WeatherForecast' does not have an associated TypeConverter that supports conversion from a string. Apply 'TypeConverterAttribute' to the type to register a converter.
@page "/counter"
@using Blazor.Extensions
@using BlazorApp1.Data
@inject IHttpContextAccessor HttpContextAccessor;
@inject WeatherForecastService Wfs;

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<EditForm Model="@this">
<InputSelect @bind-Value="this.sf">
@foreach (var forecast in forecasts)
{
<option value=@forecast>@(forecast.TemperatureC)</option>
}
</InputSelect>
</EditForm>

@sf


@code {
private WeatherForecast[] forecasts;
public WeatherForecast sf { get; set; }

protected override async Task OnInitializedAsync()
{
forecasts = await Wfs.GetForecastAsync(DateTime.Now);
}
}
@page "/counter"
@using Blazor.Extensions
@using BlazorApp1.Data
@inject IHttpContextAccessor HttpContextAccessor;
@inject WeatherForecastService Wfs;

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<EditForm Model="@this">
<InputSelect @bind-Value="this.sf">
@foreach (var forecast in forecasts)
{
<option value=@forecast>@(forecast.TemperatureC)</option>
}
</InputSelect>
</EditForm>

@sf


@code {
private WeatherForecast[] forecasts;
public WeatherForecast sf { get; set; }

protected override async Task OnInitializedAsync()
{
forecasts = await Wfs.GetForecastAsync(DateTime.Now);
}
}
1 replies