Code:
/ FX-1434 / FX-1434 / 1.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
- CSharpCodeProvider.cs
- Matrix.cs
- DataGridTableStyleMappingNameEditor.cs
- ConvertEvent.cs
- ConfigXmlAttribute.cs
- FunctionImportMapping.cs
- UnsafeNativeMethods.cs
- MapPathBasedVirtualPathProvider.cs
- Graphics.cs
- METAHEADER.cs
- Exception.cs
- StaticResourceExtension.cs
- Model3D.cs
- SQLInt32Storage.cs
- XmlConverter.cs
- Function.cs
- PolicyUnit.cs
- ListViewCancelEventArgs.cs
- WebPartVerbCollection.cs
- TypeDelegator.cs
- XmlTextWriter.cs
- WebPartCatalogCloseVerb.cs
- SectionUpdates.cs
- GetPolicyDetailsRequest.cs
- SmtpException.cs
- DbMetaDataCollectionNames.cs
- OleDbConnectionFactory.cs
- Mapping.cs
- SmiContext.cs
- FromReply.cs
- HwndMouseInputProvider.cs
- ResourceIDHelper.cs
- ElementHostAutomationPeer.cs
- XappLauncher.cs
- DataSvcMapFileSerializer.cs
- StylusPointCollection.cs
- EntityContainerEntitySet.cs
- LifetimeManager.cs
- RegexCode.cs
- SemanticResultKey.cs
- RemotingServices.cs
- LineBreakRecord.cs
- DataSourceGeneratorException.cs
- SimpleHandlerBuildProvider.cs
- JsonXmlDataContract.cs
- DocumentApplicationJournalEntry.cs
- FamilyMapCollection.cs
- DataSourceXmlClassAttribute.cs
- SoapSchemaImporter.cs
- NavigationWindow.cs
- FocusTracker.cs
- ScriptResourceMapping.cs
- RouteParametersHelper.cs
- Point4D.cs
- XmlName.cs
- XmlWrappingReader.cs
- OleDbConnectionFactory.cs
- TypedDatasetGenerator.cs
- EventListener.cs
- ContractCodeDomInfo.cs
- ListItem.cs
- ConnectionPoolManager.cs
- BitmapEffectInputData.cs
- QilReference.cs
- TextDataBindingHandler.cs
- AspProxy.cs
- DataGridViewToolTip.cs
- DataGridViewRowConverter.cs
- followingquery.cs
- SafeBitVector32.cs
- Cursors.cs
- WrapperSecurityCommunicationObject.cs
- ResourcePermissionBaseEntry.cs
- DataAdapter.cs
- ObjectDataSourceFilteringEventArgs.cs
- SimpleLine.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- CommonDialog.cs
- MailAddress.cs
- IgnoreSectionHandler.cs
- BitmapCacheBrush.cs
- TypographyProperties.cs
- PrintingPermission.cs
- ClientConfigurationHost.cs
- InputReportEventArgs.cs
- WorkflowApplicationException.cs
- DocumentViewerConstants.cs
- TransportManager.cs
- ResourceProviderFactory.cs
- DataGridLinkButton.cs
- PrintPageEvent.cs
- ModelItemCollectionImpl.cs
- DateTimeStorage.cs
- ImageListUtils.cs
- InvocationExpression.cs
- DataGridViewRowEventArgs.cs
- JoinGraph.cs
- StateInitializationDesigner.cs
- TypeInitializationException.cs
- ModifierKeysValueSerializer.cs