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
- ClientViaElement.cs
- BulletDecorator.cs
- TypeValidationEventArgs.cs
- Hash.cs
- QueueProcessor.cs
- FullTextLine.cs
- ControlPropertyNameConverter.cs
- AssemblyBuilder.cs
- DataBoundControlHelper.cs
- EventLog.cs
- SQLDateTimeStorage.cs
- SchemaImporterExtensionElementCollection.cs
- FontInfo.cs
- AnnotationComponentManager.cs
- WebPartConnection.cs
- DataGridTableCollection.cs
- WSTrust.cs
- Int32Animation.cs
- TableItemPatternIdentifiers.cs
- COM2ExtendedTypeConverter.cs
- XmlDataSourceNodeDescriptor.cs
- PartialCachingAttribute.cs
- SqlCacheDependencySection.cs
- TextLineBreak.cs
- XmlSchemaDocumentation.cs
- UserPreferenceChangingEventArgs.cs
- LinqDataSourceDisposeEventArgs.cs
- ProviderConnectionPointCollection.cs
- DataMemberAttribute.cs
- RootBrowserWindowAutomationPeer.cs
- PreProcessor.cs
- SqlMultiplexer.cs
- Transaction.cs
- UpdateManifestForBrowserApplication.cs
- TextDecorationUnitValidation.cs
- PeerName.cs
- ShutDownListener.cs
- DESCryptoServiceProvider.cs
- DateTimeConverter.cs
- WindowsListViewItemCheckBox.cs
- FileAuthorizationModule.cs
- TagMapCollection.cs
- Literal.cs
- RsaSecurityKey.cs
- MasterPageParser.cs
- SynchronizedChannelCollection.cs
- PolygonHotSpot.cs
- BindingCompleteEventArgs.cs
- SqlInfoMessageEvent.cs
- ModelUIElement3D.cs
- QuadraticBezierSegment.cs
- DataException.cs
- FixedSOMLineRanges.cs
- SamlSubjectStatement.cs
- CharacterMetricsDictionary.cs
- ReferentialConstraintRoleElement.cs
- UnsafeNativeMethodsMilCoreApi.cs
- Preprocessor.cs
- DebugTrace.cs
- SrgsGrammar.cs
- TokenDescriptor.cs
- MobileListItem.cs
- SHA384.cs
- ObjectNavigationPropertyMapping.cs
- WorkflowTransactionService.cs
- EntityDataSourceUtil.cs
- ForwardPositionQuery.cs
- HMAC.cs
- Point.cs
- StateMachine.cs
- TemplateEditingFrame.cs
- BindingMemberInfo.cs
- SafeNativeMethods.cs
- CLRBindingWorker.cs
- ListManagerBindingsCollection.cs
- IListConverters.cs
- AsyncResult.cs
- WebPageTraceListener.cs
- QueryOutputWriter.cs
- UrlPath.cs
- EventProviderBase.cs
- PeekCompletedEventArgs.cs
- UnsafeNativeMethodsCLR.cs
- CrossSiteScriptingValidation.cs
- AuditLevel.cs
- RequestBringIntoViewEventArgs.cs
- Normalization.cs
- SoapHttpTransportImporter.cs
- DataGridViewRowPostPaintEventArgs.cs
- TemplateComponentConnector.cs
- InputManager.cs
- DirectoryInfo.cs
- ClaimTypeRequirement.cs
- ConnectivityStatus.cs
- TextTreeInsertElementUndoUnit.cs
- SimpleHandlerBuildProvider.cs
- CancellationTokenSource.cs
- RepeaterItemEventArgs.cs
- ListDictionary.cs
- ConstructorBuilder.cs