Skip to content

Add inference-based overload to ForNpgsqlHasEnum #620

Closed

Description

@austindrenski

Current

public static ModelBuilder ForNpgsqlHasEnum(
    [NotNull] this ModelBuilder modelBuilder, 
    [CanBeNull] string schema, 
    [NotNull] string name, 
    [NotNull] string[] labels);

public static ModelBuilder ForNpgsqlHasEnum(
    [NotNull] this ModelBuilder modelBuilder, 
    [NotNull] string name, 
    [NotNull] string[] labels);

Proposed additions

public static ModelBuilder ForNpgsqlHasEnum<TEnum>(
    [NotNull] this ModelBuilder modelBuilder, 
    [CanBeNull] string schema = null,
    [CanBeNull] string name = null,
    [CanBeNull] INpgsqlNameTranslator nameTranslator = null) 
    where TEnum : struct, Enum;
  • nameTranslator is used when name is null
  • nameTranslator is used when labels is null.
    • Should default (internally) to match the default in MapEnum<T>.

edit: Removing labels proposal. Too much complexity, not enough upside.

Activity

  1. YohDeadfall commented on Aug 29, 2018

    @YohDeadfall
    Contributor

    I thought to request it today, but you beat me (:

  2. added this to the 2.2.0 milestone on Aug 30, 2018
  3. added theissue type on Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions