Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataWeb / Design / system / Data / EntityModel / Emitters / EntityTypeEmitter.cs / 1 / EntityTypeEmitter.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.CodeDom; using System.Data.Metadata.Edm; namespace System.Data.EntityModel.Emitters { ////// Summary description for ItemTypeEmitter. /// internal sealed class EntityTypeEmitter : StructuredTypeEmitter { #region Public Methods ////// /// /// /// public EntityTypeEmitter(ClientApiGenerator generator, EntityType entity) : base(generator, entity) { } #endregion #region Protected Methods ////// /// /// protected override void EmitProperties(CodeTypeDeclaration typeDecl) { base.EmitProperties(typeDecl); foreach (EdmMember member in Item.Members) { NavigationProperty navigationProperty = (member as NavigationProperty); if ((null != navigationProperty) && (navigationProperty.DeclaringType == Item)) { NavigationPropertyEmitter navigationPropertyEmitter = new NavigationPropertyEmitter(Generator, navigationProperty, UsingStandardBaseClass); navigationPropertyEmitter.Emit(typeDecl); } } } public override CodeTypeDeclarationCollection EmitApiClass() { CodeTypeDeclarationCollection typeDecls = base.EmitApiClass(); if ( Item.KeyMembers.Count > 0 && typeDecls.Count == 1 ) { // generate xml comments for the key properties CodeTypeDeclaration typeDecl = typeDecls[0]; typeDecl.Comments.Add( new CodeCommentStatement( "", true ) ); foreach ( EdmMember keyProperty in Item.KeyMembers) { string name = keyProperty.Name; typeDecl.Comments.Add( new CodeCommentStatement( name, true ) ); } typeDecl.Comments.Add( new CodeCommentStatement( " ", true ) ); } return typeDecls; } ////// /// /// protected override void EmitTypeAttributes(CodeTypeDeclaration typeDecl) { Generator.AttributeEmitter.EmitTypeAttributes( this, typeDecl ); base.EmitTypeAttributes( typeDecl ); } ////// /// ///protected override CodeTypeReference GetBaseType() { CodeTypeReference baseType = base.GetBaseType(); return baseType; } protected override ReadOnlyMetadataCollection GetProperties() { return Item.Properties; } #endregion #region Public Properties #endregion #region Protected Properties #endregion #region Private Properties /// /// Gets the SchemaElement that this class is generating code for. /// ///public new EntityType Item { get { return base.Item as EntityType; } } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.CodeDom; using System.Data.Metadata.Edm; namespace System.Data.EntityModel.Emitters { ////// Summary description for ItemTypeEmitter. /// internal sealed class EntityTypeEmitter : StructuredTypeEmitter { #region Public Methods ////// /// /// /// public EntityTypeEmitter(ClientApiGenerator generator, EntityType entity) : base(generator, entity) { } #endregion #region Protected Methods ////// /// /// protected override void EmitProperties(CodeTypeDeclaration typeDecl) { base.EmitProperties(typeDecl); foreach (EdmMember member in Item.Members) { NavigationProperty navigationProperty = (member as NavigationProperty); if ((null != navigationProperty) && (navigationProperty.DeclaringType == Item)) { NavigationPropertyEmitter navigationPropertyEmitter = new NavigationPropertyEmitter(Generator, navigationProperty, UsingStandardBaseClass); navigationPropertyEmitter.Emit(typeDecl); } } } public override CodeTypeDeclarationCollection EmitApiClass() { CodeTypeDeclarationCollection typeDecls = base.EmitApiClass(); if ( Item.KeyMembers.Count > 0 && typeDecls.Count == 1 ) { // generate xml comments for the key properties CodeTypeDeclaration typeDecl = typeDecls[0]; typeDecl.Comments.Add( new CodeCommentStatement( "", true ) ); foreach ( EdmMember keyProperty in Item.KeyMembers) { string name = keyProperty.Name; typeDecl.Comments.Add( new CodeCommentStatement( name, true ) ); } typeDecl.Comments.Add( new CodeCommentStatement( " ", true ) ); } return typeDecls; } ////// /// /// protected override void EmitTypeAttributes(CodeTypeDeclaration typeDecl) { Generator.AttributeEmitter.EmitTypeAttributes( this, typeDecl ); base.EmitTypeAttributes( typeDecl ); } ////// /// ///protected override CodeTypeReference GetBaseType() { CodeTypeReference baseType = base.GetBaseType(); return baseType; } protected override ReadOnlyMetadataCollection GetProperties() { return Item.Properties; } #endregion #region Public Properties #endregion #region Protected Properties #endregion #region Private Properties /// /// Gets the SchemaElement that this class is generating code for. /// ///public new EntityType Item { get { return base.Item as EntityType; } } #endregion } } // 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
- CheckBoxRenderer.cs
- ByeMessage11.cs
- DataRowView.cs
- GridItemPatternIdentifiers.cs
- ResolveNameEventArgs.cs
- CalendarDataBindingHandler.cs
- DataTemplateSelector.cs
- MultitargetUtil.cs
- PersonalizationProviderCollection.cs
- SafeNativeMethodsOther.cs
- TrustSection.cs
- AccessDataSource.cs
- SchemaSetCompiler.cs
- IUnknownConstantAttribute.cs
- CompilerInfo.cs
- Section.cs
- ContextMenu.cs
- BitmapCodecInfo.cs
- GroupQuery.cs
- EditingCoordinator.cs
- AutomationPatternInfo.cs
- WindowsRichEdit.cs
- XmlAnyAttributeAttribute.cs
- ImportCatalogPart.cs
- MimeMapping.cs
- ProcessInfo.cs
- GridViewUpdatedEventArgs.cs
- WebScriptMetadataMessageEncoderFactory.cs
- MachineKeySection.cs
- SolidBrush.cs
- Stylesheet.cs
- ScriptingAuthenticationServiceSection.cs
- SessionStateContainer.cs
- TiffBitmapEncoder.cs
- SqlServer2KCompatibilityCheck.cs
- EntityContainerEntitySet.cs
- TypeDelegator.cs
- ProfilePropertySettings.cs
- TraceContext.cs
- ReadWriteObjectLock.cs
- TimeSpan.cs
- XmlQualifiedNameTest.cs
- CultureInfoConverter.cs
- SessionPageStateSection.cs
- SmtpFailedRecipientsException.cs
- Interop.cs
- DataGridViewCheckBoxColumn.cs
- SafeRightsManagementSessionHandle.cs
- ConfigurationErrorsException.cs
- FileVersion.cs
- SystemParameters.cs
- ChildDocumentBlock.cs
- DispatcherFrame.cs
- DropShadowEffect.cs
- ViewSimplifier.cs
- XmlEventCache.cs
- XmlSortKey.cs
- MsmqIntegrationBindingElement.cs
- DateTimeFormat.cs
- TemplateKeyConverter.cs
- FrameworkObject.cs
- IItemProperties.cs
- _ShellExpression.cs
- ReferencedType.cs
- GB18030Encoding.cs
- RuntimeWrappedException.cs
- SafeWaitHandle.cs
- AnimationTimeline.cs
- SplitContainer.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- CustomErrorCollection.cs
- LZCodec.cs
- DbUpdateCommandTree.cs
- XPathChildIterator.cs
- LassoSelectionBehavior.cs
- CollectionViewProxy.cs
- SqlDataSourceConfigureSortForm.cs
- ClickablePoint.cs
- TcpProcessProtocolHandler.cs
- Object.cs
- QuaternionConverter.cs
- TextUtf8RawTextWriter.cs
- IntSecurity.cs
- PanelContainerDesigner.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- XamlPoint3DCollectionSerializer.cs
- SpellerError.cs
- CqlGenerator.cs
- SByteStorage.cs
- SimplePropertyEntry.cs
- DocumentPageTextView.cs
- QuaternionRotation3D.cs
- CheckBoxPopupAdapter.cs
- ConstraintEnumerator.cs
- PassportIdentity.cs
- DecimalAnimationUsingKeyFrames.cs
- WindowVisualStateTracker.cs
- SymbolMethod.cs
- UnauthorizedWebPart.cs
- DataListItem.cs