You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(repois not UnitOfWorkRepository<TDbContext>castedRepo)thrownewInvalidCastException($"Cannot cast repository of type '{repo.GetType()}' to '{typeof(TRepo)}'");
@@ -18,5 +20,11 @@ public abstract class UnitOfWorkRepository<TDbContext> : IUnitOfWorkRepository
18
20
internalvoidDetach()=>DbContext=null;// Remove the reference to the DbContext
19
21
20
22
protectedTDbContextGetDbContext()=>DbContext??thrownewInvalidOperationException("Repository is not attached to a UnitOfWork.");
21
-
protectedDbSet<TModel>GetDbSet<TModel>()whereTModel:class=>DbContext?.Set<TModel>()??thrownewInvalidOperationException("Repository is not attached to a UnitOfWork.");
0 commit comments