Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / data / design / TypedTableHandler.cs / 2 / TypedTableHandler.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All Rights Reserved. // Information Contained Herein is Proprietary and Confidential. // //----------------------------------------------------------------------------- namespace System.Data.Design { using System; using System.CodeDom; using System.Collections; using System.ComponentModel; using System.Data; internal sealed class TypedTableHandler { private TypedDataSourceCodeGenerator codeGenerator = null; private TypedTableGenerator tableGenerator = null; private DesignTableCollection tables = null; private Hashtable columnHandlers = null; internal TypedTableHandler(TypedDataSourceCodeGenerator codeGenerator, DesignTableCollection tables) { this.codeGenerator = codeGenerator; this.tables = tables; tableGenerator = new TypedTableGenerator(codeGenerator); SetColumnHandlers(); } internal DesignTableCollection Tables { get { return tables; } } internal TypedColumnHandler GetColumnHandler(string tableName) { if( tableName == null ) { return null; } return (TypedColumnHandler) columnHandlers[tableName]; } internal void AddPrivateVars(CodeTypeDeclaration dataSourceClass) { if( tables == null ) { return; } foreach(DesignTable table in tables) { string tableClassName = table.GeneratorTableClassName; string tableVariableName = table.GeneratorTableVarName; //\\ private; dataSourceClass.Members.Add( CodeGenHelper.FieldDecl(CodeGenHelper.Type(tableClassName), tableVariableName) ); } } internal void AddTableProperties(CodeTypeDeclaration dataSourceClass) { if( tables == null ) { return; } foreach(DesignTable table in tables) { // get class/property/variable names string tableClassName = table.GeneratorTableClassName; string tablePropertyName = table.GeneratorTablePropName; string tableVariableName = table.GeneratorTableVarName; // generate 1 public property for each typed table //\\ [System.ComponentModel.Browsable(false)] //\\ [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)] //\\ public { //\\ get { //\\ return this. ; //\\ } //\\ } CodeMemberProperty tableProperty = CodeGenHelper.PropertyDecl( CodeGenHelper.Type(tableClassName), tablePropertyName, MemberAttributes.Public | MemberAttributes.Final ); tableProperty.CustomAttributes.Add( CodeGenHelper.AttributeDecl("System.ComponentModel.Browsable", CodeGenHelper.Primitive(false))); tableProperty.CustomAttributes.Add( CodeGenHelper.AttributeDecl("System.ComponentModel.DesignerSerializationVisibility", CodeGenHelper.Field(CodeGenHelper.GlobalTypeExpr(typeof(System.ComponentModel.DesignerSerializationVisibility)), "Content")) ); tableProperty.GetStatements.Add( CodeGenHelper.Return( CodeGenHelper.Field( CodeGenHelper.This(), tableVariableName))); dataSourceClass.Members.Add(tableProperty); } } internal void AddTableClasses(CodeTypeDeclaration dataSourceClass) { tableGenerator.GenerateTables(dataSourceClass); } private void SetColumnHandlers() { this.columnHandlers = new Hashtable(); foreach(DesignTable table in tables) { columnHandlers.Add(table.Name, new TypedColumnHandler(table, codeGenerator)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NotSupportedException.cs
- ServiceHostFactory.cs
- HttpErrorTraceRecord.cs
- DataGridPagerStyle.cs
- ObjectDataSourceMethodEventArgs.cs
- ChildTable.cs
- ReadOnlyDataSourceView.cs
- OwnerDrawPropertyBag.cs
- AsymmetricAlgorithm.cs
- BoolExpr.cs
- basecomparevalidator.cs
- DeclarativeCatalogPart.cs
- PlacementWorkspace.cs
- HandlerMappingMemo.cs
- WindowsAltTab.cs
- DependencyObjectType.cs
- AnnotationResource.cs
- UriTemplateMatchException.cs
- ProxyWebPart.cs
- RectAnimationUsingKeyFrames.cs
- TemplatedMailWebEventProvider.cs
- WorkflowServiceInstance.cs
- Cell.cs
- XmlDataCollection.cs
- DirectoryInfo.cs
- TargetConverter.cs
- DataServices.cs
- GacUtil.cs
- WebFormsRootDesigner.cs
- SerializationAttributes.cs
- DesignOnlyAttribute.cs
- AssemblyInfo.cs
- IdentitySection.cs
- DrawingServices.cs
- DiscreteKeyFrames.cs
- SoapProcessingBehavior.cs
- CompressStream.cs
- WebMessageEncodingElement.cs
- ThicknessKeyFrameCollection.cs
- designeractionlistschangedeventargs.cs
- AttributeCollection.cs
- SecurityDocument.cs
- ToolStripRenderEventArgs.cs
- NamespaceQuery.cs
- HtmlInputText.cs
- SQLInt64.cs
- SoapInteropTypes.cs
- ForeignKeyConstraint.cs
- ProxyAttribute.cs
- CoordinationService.cs
- InvokePattern.cs
- RadioButtonPopupAdapter.cs
- LOSFormatter.cs
- FormsAuthenticationUserCollection.cs
- control.ime.cs
- MenuItem.cs
- GroupItemAutomationPeer.cs
- Transform3DGroup.cs
- CodeDelegateCreateExpression.cs
- SimpleTextLine.cs
- ReferencedAssembly.cs
- BinHexEncoding.cs
- AnnotationResourceCollection.cs
- AsymmetricSignatureDeformatter.cs
- XAMLParseException.cs
- SystemIcmpV6Statistics.cs
- DoubleAnimationUsingPath.cs
- SmtpDateTime.cs
- HttpPostedFile.cs
- InputScopeConverter.cs
- ArrayExtension.cs
- PtsContext.cs
- StorageComplexPropertyMapping.cs
- StaticTextPointer.cs
- ReverseQueryOperator.cs
- TableLayoutPanel.cs
- XsltOutput.cs
- OleDbRowUpdatedEvent.cs
- MaterialGroup.cs
- RoleGroupCollection.cs
- MD5CryptoServiceProvider.cs
- UnhandledExceptionEventArgs.cs
- SafeFileMapViewHandle.cs
- ScriptModule.cs
- FtpCachePolicyElement.cs
- CustomErrorsSection.cs
- CompareValidator.cs
- SpellerError.cs
- FilteredReadOnlyMetadataCollection.cs
- XmlSchemaAttributeGroupRef.cs
- MessageQueueException.cs
- SpecialFolderEnumConverter.cs
- Timer.cs
- HttpCookiesSection.cs
- ClientCultureInfo.cs
- RealProxy.cs
- RoutingExtension.cs
- VariableValue.cs
- AssemblyBuilderData.cs
- SiteOfOriginContainer.cs