Entity Framework 5 Code First Relationships
Where Edward Farley begins his quest.
When Edward Farley turned twelve years old, he announced to his family, “I’m going to the library and find out how everything works.”
You might imagine that his parents would be surprised, or puzzled. But Edward had always been like this, wondering the how and why of things. In fact, his mother and father expected a day like this.
“Well, Edward, if you really want to know, then there’s only one person to ask,” said his father.
Edward nodded. “Which reading room is he in?”
Edward’s mother smiled and glanced at her husband. “He’s not in any reading room.”
Edward’s eyes got big. “Then where will I find him?”
“In Archives,” she said. “I know, Edward. Children your age aren’t allowed in Archives. But we’re old friends of the professor, and he’ll see you.”
“Really!? Wow! When can I go?”
“Whenever you’re ready,” said his father. “Right now, if you like.”
Edward nodded his head so fast it looked like it might fly off. His mother got his coat and said, while helping him on with it, “One thing, Edward. The professor is...well, a little eccentric.”
“That’s one word for it,” mumbled his father.
“So,” continued his mother, “it’s best if you listen more than talk.”
“Well then, off you go.”
Edward ran out the door, leaped onto his bicycle, and pedaled like a dervish to the library. He arrived, walked quickly to the information desk, and said, “My name’s Edward Farley. I’m supposed to see Professor Relvar. In Archives.” He emphasized the last part.
The man behind the desk glanced at a computer screen, then at Edward, then back at the screen.
“The green elevator, bottom floor, go straight, left, left, straight to number 301, knock twice--only twice--and wait.”
“OK.” Edward hurried off, repeating the instructions to himself. When he found the door, he knocked twice and waited. And waited. And waited some more. After ten minutes, he raised his hand to knock again when the door flew open and a short, pudgy man with white hair and huge reading glasses glared at him.
“You weren’t about to knock again, were you?”
Edward froze, swallowing.
“Never mind, never mind. They always do. Come in, come in, come in. Find yourself a seat. No! Not that one. Find one over here. Yes, that’s right. That one.”
The chair indicated was the only one in the room, which otherwise was a pandemonium of books, drawings, magazines and artwork. Edward wasn’t sure what other chair the professor thought he was headed for. Nor did he know where the professor would sit. The professor went behind his desk, and suddenly the floor opened and a chair shot up, stopping just as the professor sat.
“Well?” Professor Relvar asked, peering through his glasses.
Edward was dumbstruck. The Professor kept staring.
“I...want to know how it all, um, works?”
The Professor sat back. “Ah. All of it?”
“Well...yeah. I mean, no! Not all...you know, just...whatever you want to tell me.”
“Your parents,” said Professor Relvar, “were above average students. Not my best. But they remembered the little things.” He gazed at the ceiling for a few seconds, then shook himself. “Well, knowing how it all works is out of the question. No one knows that. At least, I don’t, and I’m the most knowledgable no one here. But, what I can tell you is how things relate, how we store data about things.”
“The Database?” asked Edward.
“Just so. The Database keeps it straight, and we talk to the database using the Framework. It’s all rather simple, but most people are too busy reading their books to learn much about it.”
The Professor reached out and a computer keyboard slid into position from somewhere. He tapped the monitor, which lifted up into the ceiling. The room darkened, and the opposite wall lit up. Where there’d been massive bookcases was now the biggest computer screen Edward had ever seen.
“Before you say ‘Wow,’ you should know, Dr. Nelson has a bigger one at the Pick Library.” The Professor leaned toward Edward, conspiratorially, and whispered, “We’re rivals, but I secretly admire his work.
Edward nodded, and Professor Relvar began....