public DataContextEntityHookEvents <TDataContext, T, TState> ForEntity <T>()
            where T : class
        {
            DataContextEntityHookEvents <TDataContext, T, TState> tHooks;

            if (entityHooksEvents.TryGetValue(typeof(T), out var hooks))
            {
                if (hooks != null)
                {
                    return((DataContextEntityHookEvents <TDataContext, T, TState>)hooks);
                }

                entityHooksEvents[typeof(T)] = tHooks = new DataContextEntityHookEvents <TDataContext, T, TState>();
                return(tHooks);
            }

            entityHooksEvents.Add(typeof(T), tHooks = new DataContextEntityHookEvents <TDataContext, T, TState>());
            return(tHooks);
        }
 private DataContextHookCollection(Dictionary <Type, IDataContextEntityHookEvents <TDataContext, TState> > entityHooksEvents, DataContextEntityHookEvents <TDataContext, object, TState> generalHookEvents)
 {
     this.entityHooksEvents = entityHooksEvents;
     this.generalHookEvents = generalHookEvents;
 }