mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.3 KiB
31 lines
1.3 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Text.Json;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Design;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Squidex.Infrastructure.Json.System;
|
|
|
|
namespace Squidex.Providers.SqlServer.App;
|
|
|
|
public sealed class SqlServerAppDbContextDesignTimeFactory : IDesignTimeDbContextFactory<SqlServerAppDbContext>
|
|
{
|
|
public SqlServerAppDbContext CreateDbContext(string[] args)
|
|
{
|
|
const string ConnectionString = "Server=localhost;Port=14330;Database=test;User=sa;Password=SqlServer2026!?";
|
|
|
|
var builder = new DbContextOptionsBuilder<SqlServerAppDbContext>()
|
|
.UseSqlServer(ConnectionString, options =>
|
|
{
|
|
options.UseNetTopologySuite();
|
|
})
|
|
.ReplaceService<IMigrationsSqlGenerator, SqlServerScriptMigrationsSqlGenerator>();
|
|
|
|
return new SqlServerAppDbContext(builder.Options, new SystemJsonSerializer(JsonSerializerOptions.Default));
|
|
}
|
|
}
|