1 //---------------------------------------------------------------------
2 // <copyright file="Util.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
11 using System.Collections.Generic;
12 using System.Data.Common;
13 using System.Diagnostics;
16 namespace System.Data.Metadata.Edm
19 /// Class holding utility functions for metadata
21 internal static class Util
25 /// Throws an appropriate exception if the given item is a readonly, used when an attempt is made to change
28 /// <param name="item">The item whose readonly is being tested</param>
29 internal static void ThrowIfReadOnly(MetadataItem item)
31 Debug.Assert(item != null, "The given item is null");
34 throw EntityUtil.OperationOnReadOnlyItem();
39 /// Check to make sure the given item do have identity
41 /// <param name="item">The item to check for valid identity</param>
42 /// <param name="argumentName">The name of the argument</param>
43 [Conditional("DEBUG")]
44 internal static void AssertItemHasIdentity(MetadataItem item, string argumentName)
46 Debug.Assert(!string.IsNullOrEmpty(item.Identity), "Item has empty identity.");
47 EntityUtil.GenericCheckArgumentNull(item, argumentName);