Entity Framework Core Part 9 - The Fluent API

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 28

  • @CodingTutorialsAreGo
    @CodingTutorialsAreGo  4 года назад +2

    Any questions or suggestions? Do add a comment.
    Source code is at github.com/JasperKent/Entity-Framework-Fluent-API
    Subscribe for more at: ruclips.net/channel/UCqWQzlUDdllnLmtgfSgYTCA
    And if you liked it, give it a 👍!

    • @niroshanmanoharan4295
      @niroshanmanoharan4295 3 года назад

      Thank you for the reply "Auditable BaseEntity" this is my base entity when I inherited this to customer class it's automatically creating a table when doing the migration. How to ignore creating the table.

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  3 года назад

      @@niroshanmanoharan4295 There are two ways to do inheritance in EF Core, known as Table Per Hierarchy and Table Per Type. (EF6 also has Table Per Concrete Type). Try this video for details and let me know if it helps: ruclips.net/video/0ndu7Zhc84Q/видео.html

  • @robdevoer1
    @robdevoer1 Год назад +1

    I am so glad that I ran into your marvellous series today. After years of working with C# and EF you managed to fill in a few holes in my knowledge and made me understand some of my bad habits. Your clear and detailed approach in every session of this tutorial series is enjoyable and kept me engaged. A big thanks!!

  • @oncalldev
    @oncalldev 2 года назад +2

    Very clear explanation. Just popped in on Part 9. I'm sure I'll be circling back to view the prior tutorials as well the seeing the subsequent ones. Thanks.

  • @nitish_5262
    @nitish_5262 Год назад +2

    thankyou thankyou thankyou. commenting in 12.43 am thanks a lot for this explanation

  • @danielvelkov116
    @danielvelkov116 3 года назад +7

    ty colonel sanders for this tutorial

  • @ajonescouk
    @ajonescouk 3 года назад +1

    Thanks again. I'm working my way through your videos so you may cover this later *but* it strikes me that classes designed specifically as code-first tables (the first M in MVVM) are nicely configured with attributes. Classes in my libraries (I do optics so have utility classes representing a prism, for example) can be more nicely configured using Fluent API - that way my library never has to "know" that the classes will be stored in a database but my Model library can still configure as needed.
    Your videos are really helping me to clean my data access code so the whole lot is going to be more logical to read back in 5 years time, thank you!

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  3 года назад

      Yes, you're right - using the fluent API makes your entity classes ignorant of the the DB. That said, the Model in MVV-M shouldn't really be stored directly in the database. See ruclips.net/video/6145Q1juVHI/видео.html, which covers MVC, but the M is the same.

  • @hanspetervollhorst1
    @hanspetervollhorst1 2 года назад +3

    Don't understand why this channel has so few subscribers.

  • @sagivalia5041
    @sagivalia5041 Год назад +1

    Hey there, when I override the OnModelCreating method, do I need to do all the work EF does along with the special configs that I wanna do?
    or can I call base.OnModelCreating and then do the special configs that I want?

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  Год назад +1

      You should call base.OnModelCreating and then just do what is different from the conventional mapping.

  • @AshleyMathClass
    @AshleyMathClass 2 года назад +1

    do any of your EF videos show adding unique constraints on multiple columns?

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 года назад +1

      I don't think I have, but the answer here seems to do it: stackoverflow.com/a/4950635/2667528

  • @acattani
    @acattani 2 года назад +1

    Excellent lesson. Thank you.

  • @coldhands92
    @coldhands92 Год назад +1

    how does without adding migrations and updating db your sql server db is getting updated just by running the project ??

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  Год назад

      That's because I use 'EnsureCreated'. It looks to see if the DB exists, and if not, creates it. I wouldn't use it in a real application because, as you say, we lose the migration history. But it's handy for demos.

    • @coldhands92
      @coldhands92 Год назад +1

      @@CodingTutorialsAreGo oh so are u deleting the db and re creating it everytime ?even with that for demo it's actually smart I just wanted to learn about fluent api so I didn't know how u set it up. Thanks for responding.

  • @נדבשטיבל
    @נדבשטיבל Год назад +1

    Thank you!

  • @zergzerg4844
    @zergzerg4844 Год назад

    Do I need after the whole configuring delete the OnModulcreating method?

  • @niroshanmanoharan4295
    @niroshanmanoharan4295 3 года назад

    Thank you for the video.
    When we using Fluent Api as a separate base class it automatically creating a table. How to avoid this? Could you please explain?
    public void Configure(EntityTypeBuilder builder)
    {
    builder
    .Property(v => v.CreatedBy)
    .HasMaxLength(20);
    builder
    .Property(v => v.LastModifiedBy)
    .HasMaxLength(20);
    }

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  3 года назад +1

      Hi Niroshan, Thanks for the question, but I'm not really getting what the problem is. Can you add a little more information? Cheers.

  • @hanspetervollhorst1
    @hanspetervollhorst1 2 года назад

    EFCoreWeb is not in the repository

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 года назад

      Sorry about that. I'll see if I can resurrect it.

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 года назад

      Actually, that project is never used in what we're discussing here - I guess that's why I deleted it before I pushed.

  • @emreaka3965
    @emreaka3965 3 года назад +2

    Thanks!

  • @ohaRega
    @ohaRega 3 года назад +1

    Thank you!