Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntityDesign / Design / System / Data / EntityModel / Emitters / EntityTypeEmitter.cs / 1 / 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
- ObjectStateEntryDbDataRecord.cs
- JoinTreeSlot.cs
- diagnosticsswitches.cs
- NegotiateStream.cs
- wgx_render.cs
- Interfaces.cs
- Form.cs
- BinaryFormatterWriter.cs
- ExtensionQuery.cs
- DesignUtil.cs
- WindowsTreeView.cs
- ObjectDataSourceFilteringEventArgs.cs
- CommonDialog.cs
- SoapCommonClasses.cs
- ObjectConverter.cs
- CommandConverter.cs
- TypeListConverter.cs
- SymbolTable.cs
- TransformerConfigurationWizardBase.cs
- Image.cs
- TextRangeSerialization.cs
- SqlDuplicator.cs
- DateTimePicker.cs
- BitmapImage.cs
- Calendar.cs
- StructuredType.cs
- PingReply.cs
- ContainerCodeDomSerializer.cs
- BaseParaClient.cs
- ObjectSpanRewriter.cs
- TraceLevelStore.cs
- XmlElementElementCollection.cs
- ProvidePropertyAttribute.cs
- EncoderParameters.cs
- DataGridViewRowHeaderCell.cs
- Int32Converter.cs
- StructuredType.cs
- SplashScreenNativeMethods.cs
- IntellisenseTextBox.cs
- DbProviderFactories.cs
- ExceptionRoutedEventArgs.cs
- contentDescriptor.cs
- IImplicitResourceProvider.cs
- HtmlInputButton.cs
- Thread.cs
- DataGrid.cs
- initElementDictionary.cs
- BigIntegerStorage.cs
- EventLogPermissionAttribute.cs
- DesignerOptionService.cs
- InternalPolicyElement.cs
- RSAOAEPKeyExchangeFormatter.cs
- Inflater.cs
- InstanceDataCollection.cs
- EntityCommand.cs
- CriticalHandle.cs
- CalendarAutoFormat.cs
- TabletDevice.cs
- lengthconverter.cs
- ToolStripDropTargetManager.cs
- EncodingTable.cs
- tibetanshape.cs
- SecurityHeaderElementInferenceEngine.cs
- ScrollEvent.cs
- AdCreatedEventArgs.cs
- AnnotationResourceCollection.cs
- TimeZoneNotFoundException.cs
- TextTabProperties.cs
- ToolStripControlHost.cs
- Int32RectValueSerializer.cs
- SingleResultAttribute.cs
- OpCellTreeNode.cs
- DependencyObjectCodeDomSerializer.cs
- ActiveXSite.cs
- webeventbuffer.cs
- AddInAdapter.cs
- SingleKeyFrameCollection.cs
- UpdateExpressionVisitor.cs
- RegexRunnerFactory.cs
- PathTooLongException.cs
- TraceContextEventArgs.cs
- PrePrepareMethodAttribute.cs
- ObjectRef.cs
- MenuDesigner.cs
- BlurBitmapEffect.cs
- SamlAuthorizationDecisionStatement.cs
- CounterSampleCalculator.cs
- TraversalRequest.cs
- CalendarDay.cs
- DataBindEngine.cs
- DataControlImageButton.cs
- RangeBase.cs
- ContainerControl.cs
- _AutoWebProxyScriptHelper.cs
- regiisutil.cs
- ConfigUtil.cs
- WebPartCancelEventArgs.cs
- BindingMAnagerBase.cs
- SimpleWorkerRequest.cs
- updateconfighost.cs