Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntityDesign / Design / System / Data / EntityModel / Emitters / EntityTypeEmitter.cs / 2 / EntityTypeEmitter.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.CodeDom; using System.Data; using Som=System.Data.EntityModel.SchemaObjectModel; 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 ( NavigationProperty navigationProperty in Item.GetDeclaredOnlyMembers() ) { 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(); if (baseType == null) { baseType = TypeReference.EntityTypeBaseClass; } 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; using System.Collections.Generic; using System.CodeDom; using System.Data; using Som=System.Data.EntityModel.SchemaObjectModel; 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 ( NavigationProperty navigationProperty in Item.GetDeclaredOnlyMembers() ) { 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(); if (baseType == null) { baseType = TypeReference.EntityTypeBaseClass; } 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
- ObservableCollection.cs
- AssemblyCollection.cs
- ImageSource.cs
- TagMapCollection.cs
- AssemblyUtil.cs
- RepeatBehavior.cs
- HostProtectionException.cs
- FactoryId.cs
- OperationInvokerTrace.cs
- Viewport2DVisual3D.cs
- OledbConnectionStringbuilder.cs
- TextMetrics.cs
- StyleConverter.cs
- TextDecorationCollectionConverter.cs
- SqlDataSourceFilteringEventArgs.cs
- CoreChannel.cs
- XPathNodeHelper.cs
- WmfPlaceableFileHeader.cs
- RegisteredArrayDeclaration.cs
- ProviderCommandInfoUtils.cs
- XmlEncoding.cs
- Lasso.cs
- ContextProperty.cs
- SqlProcedureAttribute.cs
- WSDualHttpBinding.cs
- ResourceDisplayNameAttribute.cs
- AddressHeader.cs
- BookmarkScopeHandle.cs
- TypeRestriction.cs
- XsltConvert.cs
- precedingsibling.cs
- ComboBoxItem.cs
- InlinedAggregationOperatorEnumerator.cs
- FixedLineResult.cs
- ScheduleChanges.cs
- MembershipSection.cs
- IDReferencePropertyAttribute.cs
- EventHandlersStore.cs
- MetadataArtifactLoaderCompositeFile.cs
- CustomTypeDescriptor.cs
- EdgeModeValidation.cs
- SerTrace.cs
- SqlError.cs
- SoapHttpTransportImporter.cs
- PropertyDescriptorCollection.cs
- SqlFactory.cs
- NodeLabelEditEvent.cs
- AdornerDecorator.cs
- WindowsListViewGroupHelper.cs
- BinHexEncoder.cs
- ContextMenuAutomationPeer.cs
- IEnumerable.cs
- Duration.cs
- StringSource.cs
- NavigationCommands.cs
- PolygonHotSpot.cs
- ThreadStaticAttribute.cs
- _LocalDataStore.cs
- AccessDataSourceDesigner.cs
- CreateRefExpr.cs
- ZipIOExtraFieldPaddingElement.cs
- DiagnosticEventProvider.cs
- DataGridViewControlCollection.cs
- RijndaelCryptoServiceProvider.cs
- GridViewEditEventArgs.cs
- FunctionNode.cs
- PageParserFilter.cs
- TextSpanModifier.cs
- Base64Encoder.cs
- precedingquery.cs
- ButtonChrome.cs
- ApplicationActivator.cs
- ErrorWrapper.cs
- MetadataItemSerializer.cs
- LinkClickEvent.cs
- HMACSHA1.cs
- RedirectionProxy.cs
- SystemException.cs
- FunctionDetailsReader.cs
- XamlReader.cs
- WebPartConnectionsCancelVerb.cs
- StreamInfo.cs
- HashCryptoHandle.cs
- ReadOnlyDataSourceView.cs
- TaskExceptionHolder.cs
- ReachIDocumentPaginatorSerializer.cs
- Cursors.cs
- KeyValueInternalCollection.cs
- RegionData.cs
- PerspectiveCamera.cs
- RangeValidator.cs
- GroupBoxRenderer.cs
- ObjectToken.cs
- XmlParserContext.cs
- ExtractedStateEntry.cs
- ClientCultureInfo.cs
- NonBatchDirectoryCompiler.cs
- GridViewHeaderRowPresenter.cs
- TextTreeNode.cs
- BamlTreeNode.cs