Created
March 23, 2012 03:38
-
-
Save tkellogg/2166519 to your computer and use it in GitHub Desktop.
Why Object IDs & Primary Keys Are Implementation Details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Word { | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public IList<Definition> Definitions { get; private set; } | |
} | |
public class Definition { | |
public int Id { get; set; } | |
public int WordId { get; set; } | |
public string Text { get; set; } | |
public string Example { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Word { | |
private object Id { get; set; } | |
public string Name { get; set; } | |
public IList<Definition> Definitions { get; private set; } | |
public void Add(Definition definition) { | |
if (definition == null) throw new ArgumentNullException(); | |
Definitions.Add(definition); | |
} | |
} | |
public class Definition { | |
public Definition(string text, string example) { | |
Text = text; | |
Example = example; | |
} | |
private object Id { get; set; } | |
public string Text { get; private set; } | |
public string Example { get; private set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id": "09823bcf7de88c", | |
"name": "LOL", | |
"definitions": [ | |
{ | |
"text": "Laugh Out Loud" | |
"example": "I can't wait for the wedding. LOL" | |
}, | |
{ | |
"text": "Lots Of Love", | |
"example": "I don't have the heart to let my mom know that LOL doesn't actually mean Lots Of Love" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment