How can we improve Entity Framework Core?

Custom type mapping and type conversion support

Currently the only conversion available in EF Core libraries 4.5 and EF 5.0 are enums mapped to integers but that is only tip of the iceberg. There is whole big feature behind - simple type mapping or conversions defined directly in mapping.

For example what if my database contains char column with Y, N values and I want to map it to bool property directly without any additional stuff doing the conversion inside my entity? Or more complex example - what if my column contains value like en-us and I want to map it to instance of CultureInfo? There are so many examples which can fit into this feature ...

Feature like enum mapping scales EF mapping features by inches. Ability to define custom conversion or simple type mapping scales EF mapping features by miles.

3,347 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Ladislav MrnkaLadislav Mrnka shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    73 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Anonymous commented  ·   ·  Flag as inappropriate

        Guys, it is really important feature. Please implement it. Or We will celebrate 4 years in February?

      • Mikkel LundMikkel Lund commented  ·   ·  Flag as inappropriate

        Is this coming to EF6? We really need an easy way to work with NodaTime in legacy databases.

      • Dirk WatkinsDirk Watkins commented  ·   ·  Flag as inappropriate

        Enum to a lookup DB table please, with a nice display name column based on the Description attribute.

      • SørenSøren commented  ·   ·  Flag as inappropriate

        Arh, finally some light at the end of the tunnel! NodaTime will be much easier to use. TimeSpan >24h duration can be solved. Proper domain models can be based directly on entity classes without sacrificing clarity. Custom value types can be used directly in entity classes. The world will be a better place when issue 242 finally gets resolved :)

      • MisiuMisiu commented  ·   ·  Flag as inappropriate

        @Diego any updates? As @Dan mentioned I'd also would be happy to have this as a build-in feature.

      • Dan MDan M commented  ·   ·  Flag as inappropriate

        @Diego Vega, can you update us on the progress of this? We've passed the 4-year anniversary of this request, which is now the 3rd most popular on UserVoice. Not having this feature is causing a lot of pain. I hope this has finally become a priority for your team. Thank you!

      • Aron TsangAron Tsang commented  ·   ·  Flag as inappropriate

        I hope you reconsider your stance on this feature. As it stands OData4/EF is broken. The OData team are pushing for usage of Microsoft.OData.Edm.Library.Date (whilst dropping support for DateTime) whilst your team are quite frankly refusing to support deserialization of DbDate to anything except DateTime.
        It seems like your two teams are giving conflicting response, when the OData project lives and dies on EF support.

      • Paul LeePaul Lee commented  ·   ·  Flag as inappropriate

        I just can not understand, this should be a quick and easy update to EF and yet 4 years has passed and this is still not being selected for development.

        A clear explanations to why this is such a mission impossible for the development team is also missing.

        Strange.

      • Mark JunkerMark Junker commented  ·   ·  Flag as inappropriate

        I'd really like to see a full featured type conversion API like the one from NHibernate which is just done right.

      • Nathan Alden, Sr.Nathan Alden, Sr. commented  ·   ·  Flag as inappropriate

        A feature to map enums to and from strings in the database is very important when dealing with PostgreSQL custom enum types, which may be represented as strings.

      • Zackary GeersZackary Geers commented  ·   ·  Flag as inappropriate

        This is a major feature for several database designs I've worked with, I'd really love to see this back in the queue. It will provide a lot more flexibility in working with legacy databases, and improve the ability to transition from other products onto EF.

      • NeilNeil commented  ·   ·  Flag as inappropriate

        Terrible, absolutely terrible, that an enterprise engine like entity framework doesn't support basic unsigned data types. Just awful, pathetic.

      • bill darcybill darcy commented  ·   ·  Flag as inappropriate

        i'm hoping for simple mapping of values in a database lookup table to an enum or any other structure (e.g. Dictionary) so that my code is always in sync with the values in the database table. if this were initially limited to an int and nvarchar columns, that would be a huge benefit.

      • Dan MDan M commented  ·   ·  Flag as inappropriate

        "Planned" makes *much* more sense than "no status" (and is a huge relief). Thank you for clarifying!

      ← Previous 1 3 4

      Feedback and Knowledge Base