Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / Binding / BindingUtils.cs / 1305376 / BindingUtils.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Utilities for binding related operations // // //--------------------------------------------------------------------- namespace System.Data.Services.Client { #region Namespaces using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Collections; #endregion ///Utilities for binding related operations internal static class BindingUtils { ////// Throw if the entity set name is null or empty /// /// entity set name. /// entity instance for which the entity set name is generated. internal static void ValidateEntitySetName(string entitySetName, object entity) { if (String.IsNullOrEmpty(entitySetName)) { throw new InvalidOperationException(Strings.DataBinding_Util_UnknownEntitySetName(entity.GetType().FullName)); } } ////// Given a collection type, gets it's entity type /// /// Input collection type ///Generic type argument for the collection internal static Type GetCollectionEntityType(Type collectionType) { while (collectionType != null) { if (collectionType.IsGenericType && WebUtil.IsDataServiceCollectionType(collectionType.GetGenericTypeDefinition())) { return collectionType.GetGenericArguments()[0]; } collectionType = collectionType.BaseType; } return null; } ///Verifies the absence of observer for an DataServiceCollection ///Type of DataServiceCollection /// Non-typed collection object /// Collection property of the source object which is being assigned to /// Type of the source object internal static void VerifyObserverNotPresent(object oec, string sourceProperty, Type sourceType) { Debug.Assert(BindingEntityInfo.IsDataServiceCollection(oec.GetType()), "Must be an DataServiceCollection."); DataServiceCollection typedCollection = oec as DataServiceCollection ; if (typedCollection.Observer != null) { throw new InvalidOperationException(Strings.DataBinding_CollectionPropertySetterValueHasObserver(sourceProperty, sourceType)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //// Utilities for binding related operations // // //--------------------------------------------------------------------- namespace System.Data.Services.Client { #region Namespaces using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Collections; #endregion ///Utilities for binding related operations internal static class BindingUtils { ////// Throw if the entity set name is null or empty /// /// entity set name. /// entity instance for which the entity set name is generated. internal static void ValidateEntitySetName(string entitySetName, object entity) { if (String.IsNullOrEmpty(entitySetName)) { throw new InvalidOperationException(Strings.DataBinding_Util_UnknownEntitySetName(entity.GetType().FullName)); } } ////// Given a collection type, gets it's entity type /// /// Input collection type ///Generic type argument for the collection internal static Type GetCollectionEntityType(Type collectionType) { while (collectionType != null) { if (collectionType.IsGenericType && WebUtil.IsDataServiceCollectionType(collectionType.GetGenericTypeDefinition())) { return collectionType.GetGenericArguments()[0]; } collectionType = collectionType.BaseType; } return null; } ///Verifies the absence of observer for an DataServiceCollection ///Type of DataServiceCollection /// Non-typed collection object /// Collection property of the source object which is being assigned to /// Type of the source object internal static void VerifyObserverNotPresent(object oec, string sourceProperty, Type sourceType) { Debug.Assert(BindingEntityInfo.IsDataServiceCollection(oec.GetType()), "Must be an DataServiceCollection."); DataServiceCollection typedCollection = oec as DataServiceCollection ; if (typedCollection.Observer != null) { throw new InvalidOperationException(Strings.DataBinding_CollectionPropertySetterValueHasObserver(sourceProperty, sourceType)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FrameworkName.cs
- WinFormsSecurity.cs
- SearchForVirtualItemEventArgs.cs
- ValidationSummary.cs
- TextContainerHelper.cs
- X509Certificate2.cs
- BookmarkList.cs
- EntityContainerEntitySetDefiningQuery.cs
- MultiSelectRootGridEntry.cs
- SqlProvider.cs
- TypeSystemProvider.cs
- OutKeywords.cs
- ViewCellRelation.cs
- AvTraceDetails.cs
- StructuralCache.cs
- WhitespaceRule.cs
- BuildProvidersCompiler.cs
- WindowsFormsHelpers.cs
- Group.cs
- ItemPager.cs
- Size3D.cs
- SQlBooleanStorage.cs
- EntityParameterCollection.cs
- SystemPens.cs
- BamlTreeMap.cs
- OleDbEnumerator.cs
- oledbconnectionstring.cs
- WindowsContainer.cs
- EncoderReplacementFallback.cs
- DebugView.cs
- ContextProperty.cs
- UnsafeNativeMethods.cs
- PageWrapper.cs
- TextViewDesigner.cs
- TaskForm.cs
- EncoderExceptionFallback.cs
- DataRelation.cs
- CodeCompiler.cs
- AllMembershipCondition.cs
- SqlDataAdapter.cs
- DefaultClaimSet.cs
- RightNameExpirationInfoPair.cs
- TransactionException.cs
- AppDomainManager.cs
- StaticDataManager.cs
- WindowHelperService.cs
- RequiredFieldValidator.cs
- WinEventHandler.cs
- SqlStream.cs
- InputLanguageProfileNotifySink.cs
- UTF7Encoding.cs
- WorkflowDebuggerSteppingAttribute.cs
- NameTable.cs
- DynamicField.cs
- SHA512Managed.cs
- AffineTransform3D.cs
- AddingNewEventArgs.cs
- MatrixTransform.cs
- StylusPointPropertyInfoDefaults.cs
- QueryAccessibilityHelpEvent.cs
- RewritingProcessor.cs
- RelationshipSet.cs
- InitializationEventAttribute.cs
- EntityAdapter.cs
- ReflectTypeDescriptionProvider.cs
- BitmapEffectState.cs
- LeafCellTreeNode.cs
- ToolStripLabel.cs
- TextTreeTextNode.cs
- MaskDescriptor.cs
- ProxyFragment.cs
- SqlDependencyListener.cs
- SizeValueSerializer.cs
- RootBrowserWindow.cs
- Rectangle.cs
- XmlExtensionFunction.cs
- Symbol.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- SQLResource.cs
- ApplicationHost.cs
- ProcessModule.cs
- ZipFileInfoCollection.cs
- AccessDataSource.cs
- LineServices.cs
- TypeUtils.cs
- ControlPropertyNameConverter.cs
- EntityViewGenerator.cs
- Timer.cs
- DataGridViewCellValidatingEventArgs.cs
- TokenBasedSetEnumerator.cs
- Tuple.cs
- WindowsListViewItemCheckBox.cs
- CommandEventArgs.cs
- ConfigXmlCDataSection.cs
- MD5.cs
- DataObject.cs
- SqlConnection.cs
- WsatRegistrationHeader.cs
- LinqDataSourceInsertEventArgs.cs
- StorageAssociationTypeMapping.cs