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
- TransportationConfigurationTypeInstallComponent.cs
- CodePageEncoding.cs
- SortableBindingList.cs
- TextParentUndoUnit.cs
- TransformerTypeCollection.cs
- AutomationAttributeInfo.cs
- ViewCellRelation.cs
- AtlasWeb.Designer.cs
- ProxyGenerationError.cs
- TemplateNameScope.cs
- ExpanderAutomationPeer.cs
- Matrix.cs
- CheckableControlBaseAdapter.cs
- ProbeMatchesApril2005.cs
- _NetRes.cs
- LayoutInformation.cs
- ListViewTableCell.cs
- SequentialOutput.cs
- PkcsMisc.cs
- MenuAutomationPeer.cs
- MetadataArtifactLoaderCompositeResource.cs
- WebPartTransformerCollection.cs
- SoapFormatExtensions.cs
- ErrorTableItemStyle.cs
- StringFormat.cs
- SHA256.cs
- SqlParameterizer.cs
- IHttpResponseInternal.cs
- XmlSerializerVersionAttribute.cs
- RootProfilePropertySettingsCollection.cs
- FormatterConverter.cs
- XslVisitor.cs
- SecurityDocument.cs
- SectionUpdates.cs
- StylusTouchDevice.cs
- ConfigurationValues.cs
- XmlNamedNodeMap.cs
- FileDialog_Vista_Interop.cs
- TextParagraphCache.cs
- WebBaseEventKeyComparer.cs
- StopRoutingHandler.cs
- InputReferenceExpression.cs
- SizeAnimation.cs
- SplineKeyFrames.cs
- ProviderSettingsCollection.cs
- DataGridViewRowEventArgs.cs
- IndexerNameAttribute.cs
- SchemaImporter.cs
- Evidence.cs
- PersianCalendar.cs
- MouseOverProperty.cs
- HttpModuleActionCollection.cs
- OuterGlowBitmapEffect.cs
- InternalConfigConfigurationFactory.cs
- Manipulation.cs
- RemotingConfiguration.cs
- GB18030Encoding.cs
- DirectionalLight.cs
- HierarchicalDataSourceIDConverter.cs
- RuleSettings.cs
- XhtmlBasicFormAdapter.cs
- DurableServiceAttribute.cs
- JsonFaultDetail.cs
- LightweightCodeGenerator.cs
- DetailsViewPagerRow.cs
- MdiWindowListItemConverter.cs
- DrawingAttributesDefaultValueFactory.cs
- DateTimePicker.cs
- EtwTrace.cs
- SystemIPv6InterfaceProperties.cs
- UnicodeEncoding.cs
- IgnoreSectionHandler.cs
- DateTimeOffsetConverter.cs
- VariableBinder.cs
- XmlSchemaGroupRef.cs
- Substitution.cs
- DataControlButton.cs
- ListManagerBindingsCollection.cs
- CodeTypeDeclarationCollection.cs
- ResXResourceReader.cs
- TraceSection.cs
- CellLabel.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- DeploymentSectionCache.cs
- CompleteWizardStep.cs
- DocumentOrderQuery.cs
- ForceCopyBuildProvider.cs
- FastEncoderWindow.cs
- SafeReversePInvokeHandle.cs
- GeometryGroup.cs
- ProfessionalColorTable.cs
- ControlValuePropertyAttribute.cs
- SoapFault.cs
- ExtractorMetadata.cs
- CodeCommentStatement.cs
- RichTextBoxConstants.cs
- Timer.cs
- _AutoWebProxyScriptHelper.cs
- BamlRecordHelper.cs
- XmlILConstructAnalyzer.cs