Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Design / system / Data / EntityModel / Emitters / EntityTypeEmitter.cs / 3 / 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
- FieldDescriptor.cs
- HttpStaticObjectsCollectionWrapper.cs
- XmlSchemaAttributeGroup.cs
- ASCIIEncoding.cs
- SqlGenerator.cs
- InputLanguageEventArgs.cs
- FileDialog_Vista_Interop.cs
- PrimitiveDataContract.cs
- _NegotiateClient.cs
- ProgressBarBrushConverter.cs
- SoapInteropTypes.cs
- OdbcErrorCollection.cs
- StylusSystemGestureEventArgs.cs
- DataGridViewTextBoxColumn.cs
- AppDomainCompilerProxy.cs
- BindToObject.cs
- GridSplitterAutomationPeer.cs
- DoWorkEventArgs.cs
- UnionExpr.cs
- RenderOptions.cs
- TextServicesHost.cs
- Selection.cs
- EmptyEnumerable.cs
- RangeBaseAutomationPeer.cs
- RIPEMD160.cs
- SafeCryptHandles.cs
- TrackingProfileDeserializationException.cs
- SecurityPolicyVersion.cs
- ReflectionPermission.cs
- Utils.cs
- SelectionProcessor.cs
- XmlSerializer.cs
- SqlReorderer.cs
- UserMapPath.cs
- ClientRoleProvider.cs
- FontSourceCollection.cs
- PieceDirectory.cs
- ExtensionFile.cs
- FixedSOMSemanticBox.cs
- ProjectionPruner.cs
- AdornedElementPlaceholder.cs
- TypeNameHelper.cs
- BreakRecordTable.cs
- Script.cs
- SizeAnimationBase.cs
- QilPatternVisitor.cs
- EmptyEnumerable.cs
- ZoneMembershipCondition.cs
- ComponentChangedEvent.cs
- ReaderOutput.cs
- PixelShader.cs
- ProvideValueServiceProvider.cs
- ClickablePoint.cs
- X509RawDataKeyIdentifierClause.cs
- ClonableStack.cs
- ServiceDeploymentInfo.cs
- WindowsImpersonationContext.cs
- SecurityElement.cs
- TimeStampChecker.cs
- List.cs
- TerminatorSinks.cs
- assertwrapper.cs
- UTF8Encoding.cs
- TableLayoutCellPaintEventArgs.cs
- ComPlusTypeLoader.cs
- PropertyEntry.cs
- ListViewItem.cs
- DocumentApplication.cs
- MatrixValueSerializer.cs
- InvokeBase.cs
- XmlSchemaValidator.cs
- TlsSspiNegotiation.cs
- JavaScriptSerializer.cs
- VisualStyleRenderer.cs
- DomNameTable.cs
- PageHandlerFactory.cs
- HtmlEmptyTagControlBuilder.cs
- SkipStoryboardToFill.cs
- DisableDpiAwarenessAttribute.cs
- AsynchronousChannel.cs
- ResourceDictionary.cs
- FtpWebResponse.cs
- BuildResultCache.cs
- ReceiveSecurityHeaderElementManager.cs
- UserUseLicenseDictionaryLoader.cs
- _BasicClient.cs
- GenerateScriptTypeAttribute.cs
- TeredoHelper.cs
- AdornedElementPlaceholder.cs
- RelationshipType.cs
- IgnoreFlushAndCloseStream.cs
- SignerInfo.cs
- Assembly.cs
- TextCompositionEventArgs.cs
- MsmqAppDomainProtocolHandler.cs
- TextStore.cs
- InputLangChangeRequestEvent.cs
- ApplicationFileParser.cs
- ObjectSpanRewriter.cs
- WebPartUserCapability.cs