Skip to content

Commit

Permalink
chore: Upgrade package
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Nov 10, 2024
1 parent eb3c0b5 commit 5c89853
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="9.0.0-rc.2.24474.3" />
<PackageVersion Include="MongoDB.Driver" Version="2.30.0" />
<PackageVersion Include="MySql.EntityFrameworkCore" Version="8.0.8" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageVersion Include="RavenDB.Client" Version="6.2.1" />
</ItemGroup>
<ItemGroup Label="Web">
Expand All @@ -38,7 +38,7 @@
<PackageVersion Include="bunit.generators" Version="2.0.24-preview" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="xunit.v3" Version="0.5.0-pre.27" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0-pre.42" />
<PackageVersion Include="xunit.v3" Version="0.6.0-pre.7" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0-pre.49" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace LinkDotNet.Blog.Infrastructure.Persistence.Sql.Mapping;

internal sealed class BlogPostConfiguration : IEntityTypeConfiguration<BlogPost>
{
private readonly DatabaseFacade databaseFacade;
private readonly DatabaseFacade database;

public BlogPostConfiguration(DatabaseFacade databaseFacade)
=> this.databaseFacade = databaseFacade;
public BlogPostConfiguration(DatabaseFacade database)
=> this.database = database;

public void Configure(EntityTypeBuilder<BlogPost> builder)
{
Expand All @@ -31,10 +31,10 @@ public void Configure(EntityTypeBuilder<BlogPost> builder)

var tags = builder.Property(x => x.Tags).HasMaxLength(2048);

if (databaseFacade.IsMySql())
if (database.IsMySql())
{
// MySQL EF Driver does not support arrays out of the box so we have to json serialize and deserialize them
tags.HasConversion<JsonArrayConverter>();
// tags.HasColumnType("json");
}

builder.HasIndex(x => new { x.IsPublished, x.UpdatedDate })
Expand Down
1 change: 1 addition & 0 deletions src/LinkDotNet.Blog.Web/LinkDotNet.Blog.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="System.ServiceModel.Syndication" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public static void UseMySqlAsStorageProvider(this IServiceCollection services)
{
var configuration = s.GetRequiredService<IOptions<ApplicationConfiguration>>();
var connectionString = configuration.Value.ConnectionString;
builder.UseMySQL(connectionString)
builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), mySqlOptions =>
{
mySqlOptions.EnablePrimitiveCollectionsSupport();
})
#if DEBUG
.EnableDetailedErrors()
#endif
Expand Down

0 comments on commit 5c89853

Please sign in to comment.