示例#1
0
        /// <summary>
        /// Get the model object (if any) with the first ID linked to the
        /// specifed second ID
        /// </summary>
        /// <typeparam name="TModelObject"></typeparam>
        /// <param name="model"></param>
        /// <param name="secondID"></param>
        /// <returns></returns>
        public TModelObject GetModelObject <TModelObject>(Model.Model model, TSecondID secondID)
            where TModelObject : ModelObject
        {
            string category = GetCategoryForType(typeof(TModelObject));

            if (HasFirstID(category, secondID))
            {
                TFirstID firstID = GetFirstID(category, secondID);
                return(model.GetObject(new Guid(firstID.ToString())) as TModelObject);
            }
            else
            {
                return(null);
            }
        }