Skip to content

Latest commit

 

History

History
111 lines (70 loc) · 2.64 KB

README.md

File metadata and controls

111 lines (70 loc) · 2.64 KB

FamilySearch Model Extensions

This is where the C# classes that correspond to the FamilySearch

extensions to GEDCOM X live.

NuGet Package Information

Package ID Link
Gedcomx.Model.Fs http://www.nuget.org/packages/Gedcomx.Model.Fs/

See the section on using these libraries.

To determine the latest version visit the NuGet link listed above.

Use

Building the Model

Here's a sample of FamilySearch model extensions you might use:

//create a person.
Person person = new Person() //create a person
  .SetName("...something...") //named something
  .SetGender(GenderType.Male) //male
  .SetFact(new Fact(FactType.Birth, "...sometime...", "...someplace")); 

//born sometime, someplace

Discussion discussion = new Discussion()//create a discussion
  .SetTtle("...some title..."); //with some title.

DiscussionReference discussionReference = new DiscussionReference() 

//create a reference
  .SetResource(...); //to a discussion.
person.AddExtensionElement(discussionReference); //add a discussion reference to the person.

User user = new User(); //create a FamilySearch user.

ChildAndParentsRelationship childAndParentsRelationship = new 

ChildAndParentsRelationship() //create a child-and-parents 

relationship
  .SetChild(child) //between a child
  .SetFather(father) //a father
  .SetMother(mother); //and a mother

FamilySearchPlatform doc = new FamilySearchPlatform()
  .SetDiscussion(discussion)
  .SetUser(user)
  .SetChildAndParentsRelationship(childAndParentsRelationship)
  .SetPerson(person);

XML

Here's how you might write out some FamilySearch XML:

FamilySearchPlatform fsp = ...; //construct the document
Stream stream = ...; //figure out where you want to write the XML
 
DefaultXmlSerialization serializer = ...;
serializer.Serialize(fps, stream);

XML

Here's how you might read some FamilySearch XML:

Stream stream = ...; //find the XML
 
DefaultXmlSerialization serializer = ...;
 
//read the document
FamilySearchPlatform fsp = serializer.Deserialize<FamilySearchPlatform>(stream)

JSON

Here's how you might write out some FamilySearch JSON:

FamilySearchPlatform fsp = ...; //construct the document
Stream stream = ...; //figure out where you want to write the JSON
 
DefaultJsonSerialization serializer = ...;
 
//write the document to the stream:
Serializer.Serialize(fps, stream);

JSON

Here's how you might read some FamilySearch JSON:

Stream stream = ...; //find the JSON
 
DefaultJsonSerialization serializer = ...;
 
FamilySearchPlatform fsp = serializer.Deserialize<FamilySearchPlatform>(stream);