Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IndexerNameAttribute.cs
- UriSection.cs
- SmtpLoginAuthenticationModule.cs
- PingOptions.cs
- PeerInputChannelListener.cs
- EntityRecordInfo.cs
- ToolBarOverflowPanel.cs
- FormViewRow.cs
- ButtonFieldBase.cs
- LocalClientSecuritySettingsElement.cs
- TemplateBamlTreeBuilder.cs
- AdjustableArrowCap.cs
- ServiceManager.cs
- SqlDataSourceCustomCommandPanel.cs
- FixedSOMTableCell.cs
- UnaryNode.cs
- SpecialFolderEnumConverter.cs
- SqlNode.cs
- SaveFileDialog.cs
- MissingMethodException.cs
- NetDataContractSerializer.cs
- XmlCharacterData.cs
- CancellationTokenSource.cs
- HtmlTitle.cs
- WindowsEditBoxRange.cs
- ThousandthOfEmRealPoints.cs
- EntitySqlQueryCacheEntry.cs
- WebColorConverter.cs
- Rules.cs
- ArrangedElementCollection.cs
- TemplateControl.cs
- PenLineCapValidation.cs
- CheckBoxPopupAdapter.cs
- Config.cs
- WindowHideOrCloseTracker.cs
- IisTraceWebEventProvider.cs
- WindowsServiceElement.cs
- InvokePatternIdentifiers.cs
- TextServicesCompartmentContext.cs
- BitmapVisualManager.cs
- RegexCompilationInfo.cs
- RequestDescription.cs
- Point4DValueSerializer.cs
- AutoGeneratedFieldProperties.cs
- StringAttributeCollection.cs
- AppendHelper.cs
- Form.cs
- JsonReaderDelegator.cs
- WithStatement.cs
- DtrList.cs
- StrokeFIndices.cs
- AssemblyResourceLoader.cs
- MultiTouchSystemGestureLogic.cs
- WebConvert.cs
- ParsedAttributeCollection.cs
- SmtpFailedRecipientsException.cs
- ConstrainedDataObject.cs
- LayoutEngine.cs
- EntityDataSourceColumn.cs
- UIElement3D.cs
- FunctionGenerator.cs
- Serialization.cs
- RuntimeHelpers.cs
- RecipientInfo.cs
- NativeMethods.cs
- _ScatterGatherBuffers.cs
- XmlTextWriter.cs
- FontResourceCache.cs
- ListBindableAttribute.cs
- AlphabeticalEnumConverter.cs
- AssemblyNameProxy.cs
- WebPartManager.cs
- DisposableCollectionWrapper.cs
- QueryRewriter.cs
- remotingproxy.cs
- ProvidePropertyAttribute.cs
- Pool.cs
- PropertyPath.cs
- Journaling.cs
- TextEditorCharacters.cs
- SafeArchiveContext.cs
- HtmlGenericControl.cs
- MeshGeometry3D.cs
- FacetValues.cs
- StorageMappingItemLoader.cs
- DateTimeOffset.cs
- WrappedKeySecurityTokenParameters.cs
- CapiHashAlgorithm.cs
- PasswordRecoveryAutoFormat.cs
- AttachedAnnotationChangedEventArgs.cs
- Stackframe.cs
- StateMachineHelpers.cs
- SpecialTypeDataContract.cs
- FileAuthorizationModule.cs
- SetterBase.cs
- NullableDoubleSumAggregationOperator.cs
- CacheForPrimitiveTypes.cs
- BaseInfoTable.cs
- ClassHandlersStore.cs
- pingexception.cs