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
- RSAOAEPKeyExchangeDeformatter.cs
- DataGridColumn.cs
- ArrowControl.xaml.cs
- RSAOAEPKeyExchangeFormatter.cs
- SearchExpression.cs
- ConnectionPointCookie.cs
- SymDocumentType.cs
- SpellerError.cs
- NativeMethods.cs
- VectorCollectionConverter.cs
- TraceProvider.cs
- ZipIOCentralDirectoryBlock.cs
- UserPreferenceChangingEventArgs.cs
- bindurihelper.cs
- LineGeometry.cs
- SecurityTokenProvider.cs
- PartialList.cs
- XmlEncoding.cs
- Maps.cs
- DirectoryInfo.cs
- AdapterDictionary.cs
- OperationCanceledException.cs
- MaskDescriptor.cs
- DataGridItem.cs
- TextTreeTextElementNode.cs
- X509SecurityToken.cs
- Compiler.cs
- securestring.cs
- Walker.cs
- ExpandableObjectConverter.cs
- ViewCellSlot.cs
- SHA512Managed.cs
- SectionInput.cs
- XamlHostingConfiguration.cs
- TableLayoutStyleCollection.cs
- RangeExpression.cs
- NativeRecognizer.cs
- CallSiteHelpers.cs
- PropertyNames.cs
- Compilation.cs
- StateMachine.cs
- List.cs
- ListViewItemCollectionEditor.cs
- RequestCacheEntry.cs
- SwitchAttribute.cs
- PlatformNotSupportedException.cs
- FramingEncoders.cs
- OleDbDataAdapter.cs
- Binding.cs
- ExtensionElementCollection.cs
- EncoderNLS.cs
- SoapAttributeAttribute.cs
- BaseCodeDomTreeGenerator.cs
- OleDbPropertySetGuid.cs
- NameValueFileSectionHandler.cs
- bindurihelper.cs
- EnumConverter.cs
- SystemThemeKey.cs
- CalendarDay.cs
- SoundPlayerAction.cs
- DbModificationCommandTree.cs
- ConnectionInterfaceCollection.cs
- IndentedWriter.cs
- SyndicationDeserializer.cs
- SecurityVersion.cs
- XmlCharCheckingWriter.cs
- PassportAuthenticationModule.cs
- XmlSchemaChoice.cs
- AtlasWeb.Designer.cs
- FormParameter.cs
- CodeAttributeArgumentCollection.cs
- BindingManagerDataErrorEventArgs.cs
- ClientRolePrincipal.cs
- SocketManager.cs
- HttpProfileGroupBase.cs
- TimeSpanParse.cs
- SQLInt32Storage.cs
- ToolTip.cs
- FileVersion.cs
- DataRelationPropertyDescriptor.cs
- ActivityValidationServices.cs
- PieceDirectory.cs
- DbDataRecord.cs
- TwoPhaseCommit.cs
- DataServiceRequestOfT.cs
- oledbconnectionstring.cs
- SymbolPair.cs
- ControlAdapter.cs
- MetadataWorkspace.cs
- XPathNavigatorKeyComparer.cs
- Label.cs
- Range.cs
- ValidationContext.cs
- _NativeSSPI.cs
- BooleanFacetDescriptionElement.cs
- TypeUnloadedException.cs
- XmlUrlResolver.cs
- TextServicesCompartment.cs
- ReverseComparer.cs
- ListenerElementsCollection.cs