Noriega
Noriega
CC#
Created by Noriega on 12/24/2023 in #help
Exception about disposing DbContext
this is actually how GuildModel is defined in another file
using Microsoft.Extensions.Configuration;
using Remora.Discord.API.Abstractions.Objects;

namespace Scathach.Database.Models;

[Table("Guild")]
public sealed class GuildModel(IConfigurationRoot configuration, IGuild guild)
{
[Key]
[Column(TypeName = "varchar(32)")]
public string Id => guild.ID.ToString();

[Column(TypeName = "varchar(100)")]
public string Name { get; set; } = guild.Name;

[Column(TypeName = "varchar(16)")]
public string Prefix { get; set; } = configuration["PREFIX"]!;
}
using Microsoft.Extensions.Configuration;
using Remora.Discord.API.Abstractions.Objects;

namespace Scathach.Database.Models;

[Table("Guild")]
public sealed class GuildModel(IConfigurationRoot configuration, IGuild guild)
{
[Key]
[Column(TypeName = "varchar(32)")]
public string Id => guild.ID.ToString();

[Column(TypeName = "varchar(100)")]
public string Name { get; set; } = guild.Name;

[Column(TypeName = "varchar(16)")]
public string Prefix { get; set; } = configuration["PREFIX"]!;
}
edit: optimized it a bit
10 replies
CC#
Created by Noriega on 12/24/2023 in #help
Exception about disposing DbContext
my bad for late reply, but Guild isnt an EF object no however, GuildModel is
10 replies
CC#
Created by Noriega on 12/18/2023 in #help
Exception when attempting to use keyed dependencies
turns out I was supposed to update it from nuget
15 replies
CC#
Created by Noriega on 12/18/2023 in #help
Exception when attempting to use keyed dependencies
@Andrew (ryzngard | they/them) I was meant to update on this way earlier, but i needed to update a graphql package in my project
15 replies
CC#
Created by Noriega on 12/18/2023 in #help
Exception when attempting to use keyed dependencies
seems to be the following line when I register a gql server
serviceCollection.AddGraphQLServer()
.AddQueryType<QueryType>()
.AddType<CharacterType>();
serviceCollection.AddGraphQLServer()
.AddQueryType<QueryType>()
.AddType<CharacterType>();
15 replies
CC#
Created by Noriega on 12/18/2023 in #help
Exception when attempting to use keyed dependencies
System.InvalidOperationException: This service descriptor is keyed. Your service provider may not support keyed services. at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ThrowKeyedDescriptor()
at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.get_ImplementationType()
at Microsoft.Extensions.DependencyInjection.InternalServiceCollectionExtensions.<>c__19`1.<TryAddParameterExpressionBuilder>b__19_0(ServiceDescriptor t)
at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
at Microsoft.Extensions.DependencyInjection.InternalServiceCollectionExtensions.TryAddParameterExpressionBuilder[T](IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.InternalServiceCollectionExtensions.TryAddDataLoaderParameterExpressionBuilder(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.RequestExecutorServiceCollectionExtensions.AddGraphQLCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.HotChocolateAspNetCoreServiceCollectionExtensions.AddGraphQLServerCore(IServiceCollection services, Int32 maxAllowedRequestSize)
at Microsoft.Extensions.DependencyInjection.HotChocolateAspNetCoreServiceCollectionExtensions.AddGraphQLServer(IServiceCollection services, String schemaName, Int32 maxAllowedRequestSize)
at Scathach.Infrastructure.Extensions.ServiceCollectionExtensions.AddScathachApiServer(IServiceCollection serviceCollection) in C:\Users\crobati\OneDrive\Scathach\src\Scathach.Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 16
at Scathach.Program.ConfigureServices(WebApplicationBuilder webApplicationBuilder) in C:\Users\crobati\OneDrive\Scathach\src\Scathach\Program.cs:line 160
at Scathach.Program.Main(String[] args) in C:\Users\crobati\OneDrive\Scathach\src\Scathach\Program.cs:line 76
at Scathach.Program.<Main>(String[] args)
System.InvalidOperationException: This service descriptor is keyed. Your service provider may not support keyed services. at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ThrowKeyedDescriptor()
at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.get_ImplementationType()
at Microsoft.Extensions.DependencyInjection.InternalServiceCollectionExtensions.<>c__19`1.<TryAddParameterExpressionBuilder>b__19_0(ServiceDescriptor t)
at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
at Microsoft.Extensions.DependencyInjection.InternalServiceCollectionExtensions.TryAddParameterExpressionBuilder[T](IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.InternalServiceCollectionExtensions.TryAddDataLoaderParameterExpressionBuilder(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.RequestExecutorServiceCollectionExtensions.AddGraphQLCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.HotChocolateAspNetCoreServiceCollectionExtensions.AddGraphQLServerCore(IServiceCollection services, Int32 maxAllowedRequestSize)
at Microsoft.Extensions.DependencyInjection.HotChocolateAspNetCoreServiceCollectionExtensions.AddGraphQLServer(IServiceCollection services, String schemaName, Int32 maxAllowedRequestSize)
at Scathach.Infrastructure.Extensions.ServiceCollectionExtensions.AddScathachApiServer(IServiceCollection serviceCollection) in C:\Users\crobati\OneDrive\Scathach\src\Scathach.Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 16
at Scathach.Program.ConfigureServices(WebApplicationBuilder webApplicationBuilder) in C:\Users\crobati\OneDrive\Scathach\src\Scathach\Program.cs:line 160
at Scathach.Program.Main(String[] args) in C:\Users\crobati\OneDrive\Scathach\src\Scathach\Program.cs:line 76
at Scathach.Program.<Main>(String[] args)
15 replies
CC#
Created by Noriega on 12/18/2023 in #help
Exception when attempting to use keyed dependencies
do you have any ideas for registering 2 dependencies with the same interface, other than directly registering the implemented class?
15 replies
CC#
Created by Noriega on 12/18/2023 in #help
Exception when attempting to use keyed dependencies
got it
15 replies
CC#
Created by Noriega on 12/18/2023 in #help
Exception when attempting to use keyed dependencies
Well my exception has nothing to do with mediatr, but do you mean if Im using reflection while registering dependencies?
15 replies
CC#
Created by Noriega on 10/24/2023 in #help
✅ Newtonsoft serializing returns nothing with custom converter
Bump up
8 replies
CC#
Created by Noriega on 10/24/2023 in #help
✅ Newtonsoft serializing returns nothing with custom converter
so in my project, I do have objects im testing that actually have properties with this interface
8 replies
CC#
Created by Noriega on 10/24/2023 in #help
✅ Newtonsoft serializing returns nothing with custom converter
The IOptional interface is from an entire different library and the one im replicating is just a quick example also in the fiddle, the type im checking for is the Optional class I have there
8 replies
CC#
Created by Noriega on 10/24/2023 in #help
✅ Newtonsoft serializing returns nothing with custom converter
Additionally, I can replicate this with a fiddle
8 replies
DIAdiscord.js - Imagine an app
Created by Yoka on 9/2/2023 in #djs-questions
DiscordJS Hosting
There are free hosts that exist like heroku and glitch, but Id definitely advise not to use them and check out #resources
5 replies