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
- SHA384.cs
- InvokerUtil.cs
- unitconverter.cs
- PropertyMappingExceptionEventArgs.cs
- SafeSystemMetrics.cs
- Win32Exception.cs
- EntityDataSourceWrapper.cs
- TypeConverter.cs
- NameValueCollection.cs
- ReferenceTypeElement.cs
- ScrollBarRenderer.cs
- BrowsableAttribute.cs
- InputDevice.cs
- ExpressionWriter.cs
- Marshal.cs
- GcSettings.cs
- XmlReturnReader.cs
- Style.cs
- TemplateControlCodeDomTreeGenerator.cs
- SHA512Managed.cs
- SmiEventSink.cs
- RouteTable.cs
- TextSearch.cs
- MimeBasePart.cs
- CompilerLocalReference.cs
- ResourceDisplayNameAttribute.cs
- FrameworkElement.cs
- TransportContext.cs
- ConnectionsZoneDesigner.cs
- ImportCatalogPart.cs
- ArraySubsetEnumerator.cs
- XsltLibrary.cs
- InvalidEnumArgumentException.cs
- QilXmlWriter.cs
- DataGridViewAdvancedBorderStyle.cs
- Brush.cs
- EntityTransaction.cs
- Int64AnimationUsingKeyFrames.cs
- TextModifier.cs
- ConfigXmlReader.cs
- ListViewItem.cs
- Empty.cs
- SecurityDocument.cs
- WebResponse.cs
- HierarchicalDataBoundControl.cs
- StoreItemCollection.Loader.cs
- PositiveTimeSpanValidatorAttribute.cs
- ETagAttribute.cs
- StringPropertyBuilder.cs
- selecteditemcollection.cs
- CancellationToken.cs
- RSAPKCS1SignatureFormatter.cs
- TypeConverters.cs
- UserControl.cs
- WpfKnownMember.cs
- XmlFileEditor.cs
- PathFigure.cs
- RadialGradientBrush.cs
- XmlDataImplementation.cs
- TypeUnloadedException.cs
- CryptoKeySecurity.cs
- UpdateManifestForBrowserApplication.cs
- RangeValueProviderWrapper.cs
- TimeSpanConverter.cs
- ServiceModelEnumValidatorAttribute.cs
- SessionState.cs
- WebPartEditVerb.cs
- PartialArray.cs
- ConnectionProviderAttribute.cs
- UnsafeNativeMethods.cs
- TemplateManager.cs
- CodeCompileUnit.cs
- ImageDrawing.cs
- ThreadAttributes.cs
- TreeNodeCollectionEditor.cs
- _UriTypeConverter.cs
- SmiEventSink_Default.cs
- TokenBasedSetEnumerator.cs
- FlowchartDesignerCommands.cs
- TextureBrush.cs
- ExclusiveHandleList.cs
- GeometryModel3D.cs
- WindowsListViewScroll.cs
- MissingFieldException.cs
- Debug.cs
- StreamResourceInfo.cs
- ConstructorExpr.cs
- DataViewSetting.cs
- BitmapMetadataBlob.cs
- ContextInformation.cs
- RemotingConfiguration.cs
- DataGridViewHitTestInfo.cs
- SqlDataAdapter.cs
- SQLDateTimeStorage.cs
- TemplateKeyConverter.cs
- BrushValueSerializer.cs
- CryptoProvider.cs
- FragmentNavigationEventArgs.cs
- DataRecordInternal.cs
- PropertyRef.cs