/// <summary> /// Create a new IMoMorphType instance with the given parameters. /// This will add the new IMoMorphType to the owning list at the given index /// </summary> /// <param name="guid">Globally defined guid.</param> /// <param name="hvo">Some session unique HVO id.</param> /// <param name="owner">Owning list. (Must not be null.)</param> /// <param name="index">Index in owning property.</param> /// <param name="name"></param> /// <param name="nameWs"></param> /// <param name="abbreviation"></param> /// <param name="abbreviationWs"></param> /// <param name="prefix"></param> /// <param name="postfix"></param> /// <param name="secondaryOrder"></param> /// <returns></returns> void IMoMorphTypeFactoryInternal.Create(Guid guid, int hvo, ICmPossibilityList owner, int index, ITsString name, int nameWs, ITsString abbreviation, int abbreviationWs, string prefix, string postfix, int secondaryOrder) { if (owner == null) throw new ArgumentNullException("owner"); if (name == null) throw new ArgumentNullException("name"); if (abbreviation == null) throw new ArgumentNullException("abbreviation"); var morphType = new MoMorphType( m_cache, hvo, guid); owner.PossibilitiesOS.Add(morphType); morphType.Prefix = prefix; // May be null. morphType.Postfix = postfix; // May be null. morphType.SecondaryOrder = secondaryOrder; morphType.Name.set_String(nameWs, name); morphType.Abbreviation.set_String(abbreviationWs, abbreviation); morphType.IsProtected = true; // They are all protected as fas as this factory method is concerned. }
/// <summary> /// Create a new IMoMorphType instance with the given guid and owner. /// It will be added to the end of the SubPossibilities list. /// </summary> IMoMorphType IMoMorphTypeFactory.Create(Guid guid, IMoMorphType owner) { if (owner == null) throw new ArgumentNullException("owner"); IMoMorphType mmt; if (guid == Guid.Empty) { mmt = Create(); } else { int hvo = ((IDataReader)m_cache.ServiceLocator.GetInstance<IDataSetup>()).GetNextRealHvo(); mmt = new MoMorphType(m_cache, hvo, guid); } owner.SubPossibilitiesOS.Add(mmt); return mmt; }