util.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / util.cs / 1305376 / util.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 

using System; 
using System.Collections.Generic;
using System.Data.Common;
using System.Diagnostics;
using System.Text; 

namespace System.Data.Metadata.Edm 
{ 
    /// 
    /// Class holding utility functions for metadata 
    /// 
    internal static class Util
    {
        #region Methods 
        /// 
        /// Throws an appropriate exception if the given item is a readonly, used when an attempt is made to change 
        /// a property 
        /// 
        /// The item whose readonly is being tested 
        internal static void ThrowIfReadOnly(MetadataItem item)
        {
            Debug.Assert(item != null, "The given item is null");
            if (item.IsReadOnly) 
            {
                throw EntityUtil.OperationOnReadOnlyItem(); 
            } 
        }
 
        /// 
        /// Check to make sure the given item do have identity
        /// 
        /// The item to check for valid identity 
        /// The name of the argument
        [Conditional("DEBUG")] 
        internal static void AssertItemHasIdentity(MetadataItem item, string argumentName) 
        {
            Debug.Assert(!string.IsNullOrEmpty(item.Identity), "Item has empty identity."); 
            EntityUtil.GenericCheckArgumentNull(item, argumentName);
        }
        #endregion
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 

using System; 
using System.Collections.Generic;
using System.Data.Common;
using System.Diagnostics;
using System.Text; 

namespace System.Data.Metadata.Edm 
{ 
    /// 
    /// Class holding utility functions for metadata 
    /// 
    internal static class Util
    {
        #region Methods 
        /// 
        /// Throws an appropriate exception if the given item is a readonly, used when an attempt is made to change 
        /// a property 
        /// 
        /// The item whose readonly is being tested 
        internal static void ThrowIfReadOnly(MetadataItem item)
        {
            Debug.Assert(item != null, "The given item is null");
            if (item.IsReadOnly) 
            {
                throw EntityUtil.OperationOnReadOnlyItem(); 
            } 
        }
 
        /// 
        /// Check to make sure the given item do have identity
        /// 
        /// The item to check for valid identity 
        /// The name of the argument
        [Conditional("DEBUG")] 
        internal static void AssertItemHasIdentity(MetadataItem item, string argumentName) 
        {
            Debug.Assert(!string.IsNullOrEmpty(item.Identity), "Item has empty identity."); 
            EntityUtil.GenericCheckArgumentNull(item, argumentName);
        }
        #endregion
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK