Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- SourceExpressionException.cs
- SyndicationItemFormatter.cs
- DataGridCheckBoxColumn.cs
- MemberExpression.cs
- PixelFormatConverter.cs
- GlobalProxySelection.cs
- SecurityUtils.cs
- XPathPatternParser.cs
- TypeDescriptionProviderAttribute.cs
- x509store.cs
- SqlDataSourceFilteringEventArgs.cs
- FunctionOverloadResolver.cs
- FocusManager.cs
- PolicyManager.cs
- ParallelDesigner.xaml.cs
- XomlCompilerError.cs
- HandleValueEditor.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- FixedSOMContainer.cs
- Size.cs
- MiniMapControl.xaml.cs
- SoapSchemaImporter.cs
- Pkcs7Signer.cs
- SqlClientFactory.cs
- XsltContext.cs
- DesignerSerializerAttribute.cs
- WebBrowserNavigatingEventHandler.cs
- XmlNavigatorStack.cs
- ValueType.cs
- Bind.cs
- SharedUtils.cs
- NavigationWindowAutomationPeer.cs
- SupportsEventValidationAttribute.cs
- WebPartsSection.cs
- AuthenticationConfig.cs
- PngBitmapDecoder.cs
- BrowserDefinition.cs
- DataSourceControl.cs
- PopupRootAutomationPeer.cs
- InvalidTimeZoneException.cs
- RolePrincipal.cs
- AppDomainProtocolHandler.cs
- SerializationTrace.cs
- ConfigUtil.cs
- MostlySingletonList.cs
- ResolveCriteriaApril2005.cs
- figurelengthconverter.cs
- CodeCompiler.cs
- EdmSchemaError.cs
- TemplateAction.cs
- AbsoluteQuery.cs
- ContextDataSource.cs
- SqlBulkCopyColumnMappingCollection.cs
- EditingCoordinator.cs
- NamespaceExpr.cs
- FontFamily.cs
- DataGridViewColumnConverter.cs
- QueryResult.cs
- VisualTreeUtils.cs
- SqlBooleanMismatchVisitor.cs
- MatrixTransform3D.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- SiteMapDataSourceView.cs
- PartialTrustHelpers.cs
- HtmlInputRadioButton.cs
- TableHeaderCell.cs
- ReadOnlyAttribute.cs
- ListViewItem.cs
- GlyphElement.cs
- InstancePersistenceCommandException.cs
- ContainerSelectorActiveEvent.cs
- ETagAttribute.cs
- NeutralResourcesLanguageAttribute.cs
- HtmlTableCellCollection.cs
- EventMetadata.cs
- BitmapSizeOptions.cs
- DataGridViewColumnEventArgs.cs
- TdsParserHelperClasses.cs
- SHA512.cs
- NextPreviousPagerField.cs
- IssuanceLicense.cs
- PolyQuadraticBezierSegment.cs
- SessionIDManager.cs
- ValuePatternIdentifiers.cs
- SqlPersonalizationProvider.cs
- AccessDataSourceView.cs
- ALinqExpressionVisitor.cs
- PenThreadPool.cs
- parserscommon.cs
- TileModeValidation.cs
- DataKeyArray.cs
- RowsCopiedEventArgs.cs
- Parser.cs
- InputLanguageProfileNotifySink.cs
- DesignerTransaction.cs
- HttpRequestWrapper.cs
- RemoteDebugger.cs
- Keywords.cs
- SQLDecimal.cs
- TimeZone.cs