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
- SafeFileMappingHandle.cs
- FormView.cs
- QilInvoke.cs
- Substitution.cs
- ExternalException.cs
- PlaceHolder.cs
- ProviderIncompatibleException.cs
- Shape.cs
- returneventsaver.cs
- TemplatedMailWebEventProvider.cs
- PreloadedPackages.cs
- _SafeNetHandles.cs
- PropertyGeneratedEventArgs.cs
- ObjectQuery.cs
- SystemInfo.cs
- MarkupProperty.cs
- PersonalizationStateInfoCollection.cs
- SafeMILHandle.cs
- DataSourceDesigner.cs
- XmlChildEnumerator.cs
- Span.cs
- XmlReaderSettings.cs
- PngBitmapDecoder.cs
- OwnerDrawPropertyBag.cs
- ArraySubsetEnumerator.cs
- ApplicationManager.cs
- ElementUtil.cs
- SoapEnumAttribute.cs
- LockCookie.cs
- SvcMapFileLoader.cs
- AuthStoreRoleProvider.cs
- StreamInfo.cs
- ControlTemplate.cs
- DiffuseMaterial.cs
- SafePEFileHandle.cs
- SchemaImporterExtensionsSection.cs
- Block.cs
- SchemaImporterExtensionElementCollection.cs
- QueryParameter.cs
- Mutex.cs
- MappingException.cs
- MembershipSection.cs
- PackagePartCollection.cs
- PrintControllerWithStatusDialog.cs
- LayoutTable.cs
- WebPartPersonalization.cs
- SerializationAttributes.cs
- CultureSpecificCharacterBufferRange.cs
- DecoratedNameAttribute.cs
- Timeline.cs
- DataSourceNameHandler.cs
- File.cs
- GeneratedContractType.cs
- DataMemberFieldConverter.cs
- RolePrincipal.cs
- OdbcEnvironment.cs
- ScriptHandlerFactory.cs
- CodeGenerator.cs
- HuffModule.cs
- RegexWorker.cs
- ScrollBar.cs
- _SingleItemRequestCache.cs
- XmlCodeExporter.cs
- PerCallInstanceContextProvider.cs
- ParseHttpDate.cs
- WindowsSecurityToken.cs
- FullTextBreakpoint.cs
- WebBrowserContainer.cs
- ErrorFormatter.cs
- ButtonPopupAdapter.cs
- LocatorBase.cs
- DesignOnlyAttribute.cs
- PathFigure.cs
- InvalidWMPVersionException.cs
- DoubleAnimationUsingPath.cs
- CodeVariableDeclarationStatement.cs
- AsyncPostBackErrorEventArgs.cs
- MouseBinding.cs
- InlinedAggregationOperatorEnumerator.cs
- ExpandableObjectConverter.cs
- DefaultEvaluationContext.cs
- OutputCacheProfile.cs
- StrokeNode.cs
- InstanceView.cs
- SqlLiftIndependentRowExpressions.cs
- ToolBar.cs
- AtlasWeb.Designer.cs
- Int64Converter.cs
- EventSinkHelperWriter.cs
- EntityProxyFactory.cs
- FindResponse.cs
- TreeNodeSelectionProcessor.cs
- CqlGenerator.cs
- versioninfo.cs
- Documentation.cs
- XPathNode.cs
- LinqDataSourceView.cs
- AssociationProvider.cs
- SqlFactory.cs
- HtmlImage.cs