habtard
habtard
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
CREATE TABLE IF NOT EXISTS `__EFMigrationsHistory` (
`migration_id` varchar(150) CHARACTER SET utf8mb4 NOT NULL,
`product_version` varchar(32) CHARACTER SET utf8mb4 NOT NULL,
CONSTRAINT `pk___ef_migrations_history` PRIMARY KEY (`migration_id`)
) CHARACTER SET=utf8mb4;
CREATE TABLE IF NOT EXISTS `__EFMigrationsHistory` (
`migration_id` varchar(150) CHARACTER SET utf8mb4 NOT NULL,
`product_version` varchar(32) CHARACTER SET utf8mb4 NOT NULL,
CONSTRAINT `pk___ef_migrations_history` PRIMARY KEY (`migration_id`)
) CHARACTER SET=utf8mb4;
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
All migrations do is make one table, I don't think its finding my models correctly.
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
@Salman good point
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
Adding a IDesignTimeDbContextFactory has fixed it
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider.
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider.
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
The Entity Framework tools version '8.0.3' is older than that of the runtime '8.0.4'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.
The Entity Framework tools version '8.0.3' is older than that of the runtime '8.0.4'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
It does dump it but with warnings this time
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
I'll dump it to be sure, also pretty sure its every tool
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
var connectionString = config.GetConnectionString("Default");

if (string.IsNullOrEmpty(connectionString))
{
throw new Exception("Default connection string is missing");
}
var connectionString = config.GetConnectionString("Default");

if (string.IsNullOrEmpty(connectionString))
{
throw new Exception("Default connection string is missing");
}
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
well... I check that in the app
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
In DatavaseServiceCollection:
serviceCollection.AddDbContext<SadieContext>(options =>
{
options.UseMySql(connectionString, MySqlServerVersion.LatestSupportedServerVersion, mySqlOptions =>
mySqlOptions.EnableRetryOnFailure(
maxRetryCount: 10,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: null
))
.UseSnakeCaseNamingConvention();
});
serviceCollection.AddDbContext<SadieContext>(options =>
{
options.UseMySql(connectionString, MySqlServerVersion.LatestSupportedServerVersion, mySqlOptions =>
mySqlOptions.EnableRetryOnFailure(
maxRetryCount: 10,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: null
))
.UseSnakeCaseNamingConvention();
});
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
ServerServiceCollection
public static class ServerServiceCollection
{
public static void AddServices(IServiceCollection serviceCollection, IConfiguration config)
{
DatabaseServiceCollection.AddServices(serviceCollection, config);
MapperServiceCollection.AddServices(serviceCollection, config);
// ...
}
}
public static class ServerServiceCollection
{
public static void AddServices(IServiceCollection serviceCollection, IConfiguration config)
{
DatabaseServiceCollection.AddServices(serviceCollection, config);
MapperServiceCollection.AddServices(serviceCollection, config);
// ...
}
}
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
Program.cs:
var host = Host.CreateDefaultBuilder()
.ConfigureServices((context, collection) => ServerServiceCollection.AddServices(collection, context.Configuration))
.UseSerilog((hostContext, _, logger) =>
logger.ReadFrom.Configuration(hostContext.Configuration)
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning))
.Build();
var host = Host.CreateDefaultBuilder()
.ConfigureServices((context, collection) => ServerServiceCollection.AddServices(collection, context.Configuration))
.UseSerilog((hostContext, _, logger) =>
logger.ReadFrom.Configuration(hostContext.Configuration)
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning))
.Build();
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
I'll attach it here now 🙂
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
Hey the program.cs is on reddit too
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
Sorry but I am on mobile and I can’t copy it right now
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
@hime my code is in that Reddit post
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
I think the issue is my entities are in a seperate assembly to where the DbContext gets registered in the ioc?
43 replies
CC#
Created by habtard on 4/9/2024 in #help
EF core can't use any tooling
I still get Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[Sadie.Database.SadieContext]'
43 replies