Skip to content

[Request] Support for MetadataTypeAttribute #6

Description

@onodera-sf

We are using EntityFrameworkCore.PostgreSQL.ColumnEncryption.
I have one request.

I think that "NpgsqlEncrypt" is supposed to be added to the property to be encrypted,
When generating code with "Database first", "NpgsqlEncrypt" cannot be added because the code will be overwritten.

In ASP.NET Core, etc., there is a mechanism to artificially add attributes with "MetadataTypeAttribute" in consideration of this.
I would appreciate it if you could adopt this for EntityFrameworkCore.PostgreSQL.ColumnEncryption as well.

[Code example]

Auto-generated code

namespace TestPostgres.Models.Database
{
  [Table("User")]
  public partial class User
  {
    [Key]
    public int ID { get; set; }
    
    [StringLength(32)]
    public string? Name { get; set; }
  }
}

Manual add code

namespace TestPostgres.Models.Database
{
  [MetadataTypeAttribute(typeof(UserMetadata))]
  public partial class User
  {
  }

  public class UserMetadata
  {
    [NpgsqlEncrypt]
    public string? Name { get; set; }
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions