We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code doesn't work
Using a MigrationOperation shows the following code
Using a MigrationOperation
public class MyMigrationsSqlGenerator : SqlServerMigrationsSqlGenerator { public MyMigrationsSqlGenerator( MigrationsSqlGeneratorDependencies dependencies, ICommandBatchPreparer commandBatchPreparer) : base(dependencies, commandBatchPreparer) { } protected override void Generate( MigrationOperation operation, IModel model, MigrationCommandListBuilder builder) { if (operation is CreateUserOperation createUserOperation) { Generate(createUserOperation, builder); } else { base.Generate(operation, model, builder); } } private void Generate( CreateUserOperation operation, MigrationCommandListBuilder builder) { var sqlHelper = Dependencies.SqlGenerationHelper; var stringMapping = Dependencies.TypeMappingSource.FindMapping(typeof(string)); // <-------------------------- builder .Append("CREATE USER ") .Append(sqlHelper.DelimitIdentifier(operation.Name)) .Append(" WITH PASSWORD = ") .Append(stringMapping.GenerateSqlLiteral(operation.Password)) .AppendLine(sqlHelper.StatementTerminator) .EndCommand(); } }
The marked line returns null.
The CLR Type mappings simply don't contain a string type key
I am unable to find the right way of getting a string type mapping.
https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/operations
https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/managing-schemas/migrations/operations.md
aafc9673-c635-3cf2-6235-8577ff15d19c
@bricelam
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Type of issue
Code doesn't work
Description
Using a MigrationOperation
shows the following codeThe marked line returns null.
The CLR Type mappings simply don't contain a string type key
I am unable to find the right way of getting a string type mapping.
Page URL
https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/operations
Content source URL
https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/managing-schemas/migrations/operations.md
Document Version Independent Id
aafc9673-c635-3cf2-6235-8577ff15d19c
Article author
@bricelam
The text was updated successfully, but these errors were encountered: