RSCG_DbContext- idea –part 1 of 3

The  DBContext from Entity Framework has a method on Database property , named :EnsureCreated ( and one EnsureCreatedAsync)

The problem with that is that verifies JUST the name of the database – not the tables exposed in the DBSet .

So how  to do this kind of stuff – verify that the tables for a DbSet  are created  ?

And  , if the program do not know how many DbSet are in the DbContext class, how to verify for each one  ?

—-

Let you think – before reading my solution

Let you think – before reading my solution

Let you think – before reading my solution

Let you think – before reading my solution

Let you think – before reading my solution

Let you think – before reading my solution

Let you think – before reading my solution

Let you think – before reading my solution

—–

The answer for the first question is pretty simple – verify the existence of 1 item ( top / limit 1 ) , or even no items( where 1=0 ). I choose a third approach, verify the count on the table .

The answer for the second question is again pretty simple – a Roslyn Code Generator


Posted

in

,

by

Tags: