Skip to content

Commit

Permalink
Adding CustomSqlMigrationsGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
dgmjr committed Nov 12, 2023
1 parent 8be612d commit 0c61557
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 26 deletions.
12 changes: 12 additions & 0 deletions src/All/Dgmjr.EntityFrameworkCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../Abstractions/Dgmjr.EntityFrameworkCore.Abstractions.csproj" />
<ProjectReference Include="../Constants/All/Dgmjr.EntityFrameworkCore.Constants.All.csproj" />
<ProjectReference Include="../Extensions/Dgmjr.EntityFrameworkCore.Extensions.csproj" />
<ProjectReference Include="../Migrations/Dgmjr.EntityFrameworkCore.Migrations.csproj" />
<ProjectReference Include="../Models/Dgmjr.EntityFrameworkCore.Models.csproj" />
</ItemGroup>
</Project>
112 changes: 112 additions & 0 deletions src/All/Dgmjr.EntityFrameworkCore.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
Microsoft Visual Studio Solution File, Format Version 12.00
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\..\Directory.Build.props = ..\..\..\..\Directory.Build.props
..\..\..\..\Directory.Build.targets = ..\..\..\..\Directory.Build.targets
..\..\..\..\global.json = ..\..\..\..\global.json
..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.EntityFrameworkCore.Abstractions", "..\Abstractions\Dgmjr.EntityFrameworkCore.Abstractions.csproj", "{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.EntityFrameworkCore.Constants.All", "..\Constants\All\Dgmjr.EntityFrameworkCore.Constants.All.csproj", "{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.EntityFrameworkCore.Extensions", "..\Extensions\Dgmjr.EntityFrameworkCore.Extensions.csproj", "{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.EntityFrameworkCore.Migrations", "..\Migrations\Dgmjr.EntityFrameworkCore.Migrations.csproj", "{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.EntityFrameworkCore.Models", "..\Models\Dgmjr.EntityFrameworkCore.Models.csproj", "{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.EntityFrameworkCore", "Dgmjr.EntityFrameworkCore.csproj", "{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Local|Any CPU = Local|Any CPU
Debug|Any CPU = Debug|Any CPU
Testing|Any CPU = Testing|Any CPU
Staging|Any CPU = Staging|Any CPU
Production|Any CPU = Production|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Local|Any CPU.ActiveCfg = Local|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Local|Any CPU.Build.0 = Local|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Testing|Any CPU.Build.0 = Testing|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Staging|Any CPU.Build.0 = Staging|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Production|Any CPU.ActiveCfg = Local|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Production|Any CPU.Build.0 = Local|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E83297C6-8CC6-4A55-ADD2-AA2CEEE6A809}.Release|Any CPU.Build.0 = Release|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Local|Any CPU.ActiveCfg = Local|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Local|Any CPU.Build.0 = Local|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Testing|Any CPU.Build.0 = Testing|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Staging|Any CPU.Build.0 = Staging|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Production|Any CPU.ActiveCfg = Local|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Production|Any CPU.Build.0 = Local|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BAF1F3E-B3FC-47CE-9B6D-52C670E986F5}.Release|Any CPU.Build.0 = Release|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Local|Any CPU.ActiveCfg = Local|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Local|Any CPU.Build.0 = Local|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Testing|Any CPU.Build.0 = Testing|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Staging|Any CPU.Build.0 = Staging|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Production|Any CPU.ActiveCfg = Local|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Production|Any CPU.Build.0 = Local|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{963A870B-D69A-4EEC-B7DD-3FCF6B725F24}.Release|Any CPU.Build.0 = Release|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Local|Any CPU.ActiveCfg = Local|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Local|Any CPU.Build.0 = Local|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Testing|Any CPU.Build.0 = Testing|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Staging|Any CPU.Build.0 = Staging|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Production|Any CPU.ActiveCfg = Local|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Production|Any CPU.Build.0 = Local|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFDCABC6-A450-4EFA-A31F-5F7DBF7B5761}.Release|Any CPU.Build.0 = Release|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Local|Any CPU.ActiveCfg = Local|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Local|Any CPU.Build.0 = Local|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Testing|Any CPU.Build.0 = Testing|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Staging|Any CPU.Build.0 = Staging|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Production|Any CPU.ActiveCfg = Local|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Production|Any CPU.Build.0 = Local|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD67EBB3-FA03-44A5-8FB7-2B0C0BD24CFE}.Release|Any CPU.Build.0 = Release|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Local|Any CPU.ActiveCfg = Local|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Local|Any CPU.Build.0 = Local|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Testing|Any CPU.Build.0 = Testing|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Staging|Any CPU.Build.0 = Staging|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Production|Any CPU.ActiveCfg = Local|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Production|Any CPU.Build.0 = Local|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{131AE4BC-9720-4D7A-B618-4EB1CE9B563B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {260FE498-3701-4608-8F83-51A3DF241342}
EndGlobalSection
EndGlobal
35 changes: 35 additions & 0 deletions src/All/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
date: 2023-07-13T05:44:46.048Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
liimitations:
- liability
- warranty
lastmod: 2023-08-29T17:13:51.216Z
license: MIT
slug: mit-license
title: MIT License
type: license
---

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send David an email") ([@dgmjr](https://github.com/dgmjr "Contact david on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

27 changes: 27 additions & 0 deletions src/All/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title:
lastmod: 2023-57-08T06:57:56.6492-05:00Z
date: 2023-57-08T06:57:56.6493-05:00Z
license: MIT
slug: Dgmjr.EntityFrameworkCore-readme
version:
authors:
- dgmjr;
description: Dgmjr.EntityFrameworkCore Readme #TODO: write description for Dgmjr.EntityFrameworkCore Readme
keywords:
- Dgmjr.EntityFrameworkCore
- dgmjr
- dgmjr-io
type: readme
---
# Dgmjr.EntityFrameworkCore Readme
<!-- TODO: Write the contents of the Dgmjr.EntityFrameworkCore Readme file -->
## Package Description
## Getting Started
## Prerequisites
## Installation
## Usage
## Contributing
## Versioning
Built from [commit 8be612d on branch main at ]
(/tree/8be612dc6a4caab93296107541ceaebeabf742a4)
35 changes: 35 additions & 0 deletions src/Constants/All/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
date: 2023-07-13T05:44:46.048Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
liimitations:
- liability
- warranty
lastmod: 2023-08-29T17:13:51.216Z
license: MIT
slug: mit-license
title: MIT License
type: license
---

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send David an email") ([@dgmjr](https://github.com/dgmjr "Contact david on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

5 changes: 5 additions & 0 deletions src/Constants/Constants/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public static class Prefixes
public const string ch_ = nameof(ch_);
}

public static class Suffixes
{
public const string _sql = ".sql";
}

public static class UriMaxLengthConstant
{
public const int UriMaxLength = 2048;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<Using Include="Dgmjr.EntityFrameworkCore" />
<!-- <Using Include="Dgmjr.EntityFrameworkCore.Constants" /> -->
<Using Include="Dgmjr.EntityFrameworkCore.Constants.Prefixes" Static="true" />
<Using Include="Dgmjr.EntityFrameworkCore.Constants.Suffixes" Static="true" />
<!-- <Using Include="Dgmjr.EntityFrameworkCore.Constants.DbTypeNames" Static="true" /> -->
<!-- <Using Include="Dgmjr.EntityFrameworkCore.Constants.Schemas" Static="true" /> -->
</ItemGroup>
Expand Down
35 changes: 35 additions & 0 deletions src/Constants/Constants/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
date: 2023-07-13T05:44:46.048Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
liimitations:
- liability
- warranty
lastmod: 2023-08-29T17:13:51.216Z
license: MIT
slug: mit-license
title: MIT License
type: license
---

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send David an email") ([@dgmjr](https://github.com/dgmjr "Contact david on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

35 changes: 35 additions & 0 deletions src/Constants/DbTypesNamesAndSchemas/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
date: 2023-07-13T05:44:46.048Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
liimitations:
- liability
- warranty
lastmod: 2023-08-29T17:13:51.216Z
license: MIT
slug: mit-license
title: MIT License
type: license
---

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send David an email") ([@dgmjr](https://github.com/dgmjr "Contact david on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

49 changes: 49 additions & 0 deletions src/Migrations/CustomSqlMigrationsGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Update;
using Microsoft.EntityFrameworkCore.Metadata;

namespace Dgmjr.EntityFrameworkCore.Migrations;

#if !NETSTANDARD2_1_OR_GREATER
public class CustomSqlMigrationsGenerator(
MigrationsSqlGeneratorDependencies dependencies,
IMigrationsAnnotationProvider migrationsAnnotations
) : SqlServerMigrationsSqlGenerator(dependencies, migrationsAnnotations)
#elif NETSTANDARD2_1_OR_GREATER && !NET8_0_OR_GREATER
public class CustomSqlMigrationsGenerator(
MigrationsSqlGeneratorDependencies dependencies,
IRelationalAnnotationProvider annotationsProvider
) : SqlServerMigrationsSqlGenerator(dependencies, annotationsProvider)
#elif NET8_0_OR_GREATER
public class CustomSqlMigrationsGenerator(
MigrationsSqlGeneratorDependencies dependencies,
ICommandBatchPreparer commandBatchPreparer
) : SqlServerMigrationsSqlGenerator(dependencies, commandBatchPreparer)
#else
#error "Unsupported target framework"
#endif
{
protected ISqlGenerationHelper SqlHelper => Dependencies.SqlGenerationHelper;

protected override void Generate(
MigrationOperation operation,
IModel model,
MigrationCommandListBuilder builder
)
{
if (operation is CreateFunctionOperation cfo)
{
builder.Append(cfo.Sql).Append(SqlHelper.StatementTerminator).EndCommand();
}
else if (operation is DropFunctionOperation dfo)
{
builder.Append(dfo.Sql).Append(SqlHelper.StatementTerminator).EndCommand();
}
else
{
base.Generate(operation, model, builder);
}
}
}
4 changes: 4 additions & 0 deletions src/Migrations/Dgmjr.EntityFrameworkCore.Migrations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Usings" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="Dgmjr.EntityFrameworkCore.Constants.All" />
<ProjectReference Include="../Constants/DbTypesNamesAndSchemas/Dgmjr.EntityFrameworkCore.Constants.DbTypesNamesAndSchemas.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="Dgmjr.EntityFrameworkCore.Migrations.Constants" Static="true" />
<Using Include="Dgmjr.EntityFrameworkCore.DbSchemas" Static="true" />
</ItemGroup>
<Import Project="../Constants/DbTypesNamesAndSchemas/Dgmjr.EntityFrameworkCore.Constants.DbTypesNamesAndSchemas.props" />
</Project>
Loading

0 comments on commit 0c61557

Please sign in to comment.