It appears that not the entire land of Egypt was overrun by Hyksos. The occupation was more confined to the Delta region, the Lower Nile valley, and to the district of Fayoum.
The Egyptian civilization went through a huge shock with the invasion, but it was not destroyed.
The Hyksos king who led the invasion was named either Salatis or Saites. Salatis is mentioned by historian Josephus. Saites is mentioned by Africanus, Eusebius, and George the Syncellus in their writings.
Well, whoever he was, this king set up his headquarters in Memphis. Then he fortified and garrisoned various other towns in important positions.
Very little in known about this king, because there are no monuments left of this king.
The reign of Hyksos is debated to be between 2 and 5 centuries long. It is likely that the shorter time frame is more probable, because the Egyptians returned to their previous lifestyle with almost no change after the end of the Hyksos reign. They retained the same manners and customs, same religious usages, same rules of art, and same names.
Even if the initial attack was very hostile and destructive, the subsequent years were much more peaceful. Egyptians did not cause too much trouble to the conquerors. The "Shepherds" ruled over quite and unresisting subjects. The taxes were paid with no delays.
Under these circumstances, their manners began to soften. As some other invaders who have gradually assimilated into a superior civilization they had conquered, so did Hyksos. They adopted the Egyptian dress, titles, official language, art, mode of writing, architecture. Temples and statues built under later Hyksos, had the same character as purely Egyptian ones
The Hyksos brought into Egypt the worship of their single ancestral deity named Sut. He was apparently identified with the sun, "the great ruler of heaven". He was later identified with Baal. When they invaded Egypt, they destroyed every temple indiscriminately. But later, they acknowledged in the Egyptian god Set, their own Sut. Hyksos king Apepi built a great temple to this god and made sphinxes. All was very similar to Egyptian temples and sphinxes. But the sphinxes differed in that they had manes like lions and wings. They have the name of Apepi engraved on them.
According to an ancient tradition, the king who was Joseph's master, and allowed him to administer the entire Egypt, was Apepi. George the Syncellus, in his writings, states that this has been accepted by everyone in ancient times.
It is clear that Joseph's arrival to Egypt was not under the Old Empire, since horses and chariots were in use, as well as wagons or carts. That was something the Hyksos brought to Egypt. It is also more likely that a "Shepherd" king would be more likely to entrust the rule of the entire Egypt to a fellow shepherd, than a native Egyptian would. A priest of Heliopolis would scarcely have given his daughter into marriage to Joseph, unless the state of priesthood was in a depression.
Add to that the fact that the pharaoh of Joseph seems to have been ruling from Lower Egypt, rather than from Thebes. And Thebes was were Egyptian kings ruled for hundreds of years before and after the Hyksos rule.
Apepi was dominant over all of Egypt, as Joseph's pharaoh seems to have been. He acknowledged a singe god, as did that monarch. He was a thoroughly Egyptianized king, as later Hyksos kings were. He had a council of educated scribes, a magnificent court, and a peaceful reign until towards its close.
The arguments may not be thoroughly exhaustive. But if they're true, we can assign the touching story of Joseph, to the reign of the last Hyksos.
And maybe that's why the Hebrews were persecuted by a king who "did not know Joseph".