Example #1
0
        // Exceptions:
        //	System.ArgumentException:
        //		resourceDescription is null when saving ResourceDescription
        public void Save(ResourceDescription resourceDescription)
        {
            if (resourceDescription.IsNull)
            {
                throw new System.ArgumentException("resourceDescription is null when saving ResourceDescription", "resourceDescription");
            }

            if (ResourceDescriptionExists(resourceDescription.UniqueID))
            {
                ResourceDescription upToDateItemBase = new ResourceDescription();

                try
                {
                    Load(upToDateItemBase, resourceDescription.UniqueID);
                }
                catch
                {
                    SaveInternal(resourceDescription);
                    return;
                }

                if (resourceDescription.CompareTo(upToDateItemBase) != 0)
                {
                    UpdateInternal(resourceDescription);
                }
            }
            else
            {
                SaveInternal(resourceDescription);
            }
        }