RelationHandler.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / data / design / RelationHandler.cs / 2 / RelationHandler.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 RelationHandler { 
        private TypedDataSourceCodeGenerator codeGenerator = null;
        private DesignRelationCollection relations = null; 

        internal RelationHandler(TypedDataSourceCodeGenerator codeGenerator, DesignRelationCollection relations) {
            this.codeGenerator = codeGenerator;
            this.relations = relations; 
        }
 
        internal DesignRelationCollection Relations { 
            get {
                return relations; 
            }
        }

        internal void AddPrivateVars(CodeTypeDeclaration dataSourceClass) { 
            if(dataSourceClass == null) {
                throw new InternalException("DataSource CodeTypeDeclaration should not be null."); 
            } 

            if( relations == null ) { 
                return;
            }

            foreach(DesignRelation relation in relations) { 
 				if(relation.DataRelation != null) {
					//\\ private DataRelation  
                    string relationVariableName = relation.GeneratorRelationVarName; 
					dataSourceClass.Members.Add( CodeGenHelper.FieldDecl(CodeGenHelper.GlobalType(typeof(System.Data.DataRelation)), relationVariableName) );
				} 
            }
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK