Replies: 1 comment 1 reply
-
@jasontaylordev any comments? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my project, I have more than 20 tables, Does it mean that I need to create 20 DbSets in my IApplicationDbContext?
Currently, I am using the generic method and didn't create DbSet for each table:
I created the IDbEntity interface in Domain/Common folder. The purpose of this interface is: if an entity implements this interface it means it is db entity. It will not allow using any kind of class in my generic method (see below)
My IApplicationDbContext will have only GetDbSet generic method:
Implementation in ApplicationDbContext:
Why do I need this?
There will not be a lot of DbSets
If I need to add or remove a table in the future, I don't need to change my Application layer.
So, why do not make this change? Is there any design pattern/rule to separate DbSet for each table?
Beta Was this translation helpful? Give feedback.
All reactions