Has vs Owns in Entity Framework: Which one should you use?

Поділитися
Вставка
  • Опубліковано 15 жов 2024

КОМЕНТАРІ • 10

  • @mohamedal-qadeery6530
    @mohamedal-qadeery6530 Рік тому

    Your content is so amazing im sure your channel will be big in the future !

  • @lexNwimue
    @lexNwimue 3 місяці тому

    Thanks, man. Great stuff!

  • @mohamedal-qadeery6530
    @mohamedal-qadeery6530 Рік тому

    but how i can stop its from auto including the relation ?

    • @spyroskatsios
      @spyroskatsios  Рік тому +1

      What do you mean? If you set in your configurations how you want to handle your relations, it will not set them automatically. Maybe i didn't understand the question, can you give me more context?

    • @mohamedal-qadeery6530
      @mohamedal-qadeery6530 Рік тому +1

      @@spyroskatsios lets say i have a use case where i just need the person name and i dont need to include all the relations like credit cards,etc ... because by default based on the video everytime when u get the person it also includes the relation (all credit cards)

    • @spyroskatsios
      @spyroskatsios  Рік тому

      @@mohamedal-qadeery6530 Now i got it, thanks. Since they are owned entities you can't by default not include them. You can use a select and retrieve only the fields you need in this specific use case. If you have multiple read use cases like this in your project, but you still want those entities to be configured as owned, you can maybe have a different dbContext for the reads.

    • @mohamedal-qadeery6530
      @mohamedal-qadeery6530 Рік тому +1

      @@spyroskatsios can u make video or code sample in the future ? And thanks alot

    • @spyroskatsios
      @spyroskatsios  Рік тому

      @@mohamedal-qadeery6530You are welcome! About using a select clause to project to a custom object i don't think there is a lot to do. If you are talking about the second dbContext i have one: ua-cam.com/video/QkHfBNPvLms/v-deo.html