using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace UniversalEditor.ObjectModels.Package.Relationships { public class Relationship : ICloneable { public class RelationshipCollection : System.Collections.ObjectModel.Collection { /// /// Gets all s with the specified schema. /// /// The schema to search for. /// Array of objects whose Schema property is set to the specified value. public Relationship[] GetBySchema(string schema, string source = null) { List rels = new List(); foreach (Relationship rel in this) { if (rel.Schema == schema && rel.Source == source) { rels.Add(rel); } } return rels.ToArray(); } } private string mvarID = String.Empty; public string ID { get { return mvarID; } set { mvarID = value; } } private string mvarSchema = String.Empty; public string Schema { get { return mvarSchema; } set { mvarSchema = value; } } private string mvarTarget = String.Empty; public string Target { get { return mvarTarget; } set { mvarTarget = value; } } private string mvarSource = null; public string Source { get { return mvarSource; } set { mvarSource = value; } } public object Clone() { Relationship clone = new Relationship(); clone.ID = (mvarID.Clone() as string); clone.Schema = (mvarSchema.Clone() as string); clone.Source = (mvarSource.Clone() as string); clone.Target = (mvarTarget.Clone() as string); return clone; } } }