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
- XmlSchemaObject.cs
- ContextMenu.cs
- TaskFileService.cs
- SignatureDescription.cs
- DeviceFilterDictionary.cs
- ToolStripContentPanelRenderEventArgs.cs
- OdbcConnectionHandle.cs
- AssemblyAssociatedContentFileAttribute.cs
- HtmlTextArea.cs
- Win32Native.cs
- HandledEventArgs.cs
- DocumentXPathNavigator.cs
- Decimal.cs
- TemplateManager.cs
- ObjectDataSource.cs
- Repeater.cs
- RelatedPropertyManager.cs
- ExceptionRoutedEventArgs.cs
- ClientConfigPaths.cs
- GridEntry.cs
- SectionXmlInfo.cs
- COSERVERINFO.cs
- DrawingBrush.cs
- ControlPropertyNameConverter.cs
- MetabaseServerConfig.cs
- ValueExpressions.cs
- XmlBinaryWriterSession.cs
- PropertyDescriptorGridEntry.cs
- SafeFileHandle.cs
- SerialPort.cs
- UnSafeCharBuffer.cs
- SchemaReference.cs
- CfgSemanticTag.cs
- HwndSourceKeyboardInputSite.cs
- NamespaceCollection.cs
- FullTextLine.cs
- TrackingMemoryStreamFactory.cs
- BufferAllocator.cs
- EntityDesignerDataSourceView.cs
- SerializerProvider.cs
- ResourceManager.cs
- TextRangeEdit.cs
- ArrayTypeMismatchException.cs
- ConfigXmlComment.cs
- DragEventArgs.cs
- TableHeaderCell.cs
- BuildResultCache.cs
- WmlFormAdapter.cs
- NoPersistProperty.cs
- BufferedGraphicsContext.cs
- CornerRadiusConverter.cs
- ClientSettingsProvider.cs
- CellParagraph.cs
- Matrix3D.cs
- CfgSemanticTag.cs
- InputProcessorProfilesLoader.cs
- StrongNameKeyPair.cs
- SecurityState.cs
- HtmlTableCellCollection.cs
- StartUpEventArgs.cs
- SoapClientMessage.cs
- FullTextLine.cs
- RegexEditorDialog.cs
- FormsAuthenticationTicket.cs
- GridView.cs
- SafeNativeMethods.cs
- CompilerGlobalScopeAttribute.cs
- NonVisualControlAttribute.cs
- CanonicalFontFamilyReference.cs
- EnumerableRowCollectionExtensions.cs
- TransformationRules.cs
- ForEachAction.cs
- XdrBuilder.cs
- columnmapfactory.cs
- EnumMemberAttribute.cs
- TraceContextRecord.cs
- DESCryptoServiceProvider.cs
- TemplateControlBuildProvider.cs
- OrthographicCamera.cs
- WebEventTraceProvider.cs
- FirstMatchCodeGroup.cs
- DataGridViewCellValueEventArgs.cs
- WebUtil.cs
- BitConverter.cs
- WsatAdminException.cs
- DataGridViewCellFormattingEventArgs.cs
- RegexWriter.cs
- WithParamAction.cs
- documentation.cs
- ColumnPropertiesGroup.cs
- SqlMethodAttribute.cs
- Rule.cs
- columnmapkeybuilder.cs
- XsltException.cs
- PerfCounterSection.cs
- HttpListenerRequest.cs
- DynamicDataExtensions.cs
- ResourceExpressionEditorSheet.cs
- SqlClientWrapperSmiStreamChars.cs
- ObjectIDGenerator.cs