1 //---------------------------------------------------------------------
2 // <copyright file="TypeGeneratedEventArgs.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner       Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
9 using System;
10 using System.Data;
11 using System.CodeDom;
12 using System.Collections.Generic;
13 using System.Data.Metadata.Edm;
14 using System.Diagnostics;
15 
16 namespace System.Data.Entity.Design
17 {
18     /// <summary>
19     /// This class encapsulates the EventArgs dispatched as part of the event
20     /// raised when a type is generated.
21     /// </summary>
22     public sealed class TypeGeneratedEventArgs : EventArgs
23     {
24         #region Private Data
25 
26         private GlobalItem _typeSource;
27         private CodeTypeReference _baseType;
28         private List<Type> _additionalInterfaces = new List<Type>();
29         private List<CodeTypeMember> _additionalMembers = new List<CodeTypeMember>();
30         private List<CodeAttributeDeclaration> _additionalAttributes = new List<CodeAttributeDeclaration>();
31 
32         #endregion
33 
34         #region Constructors
35 
36         /// <summary>
37         /// Default constructor
38         /// </summary>
TypeGeneratedEventArgs()39         public TypeGeneratedEventArgs()
40         {
41         }
42 
43         /// <summary>
44         /// Constructor
45         /// </summary>
46         /// <param name="typeSource">The source of the event</param>
47         /// <param name="baseType">The base type of the type being generated</param>
TypeGeneratedEventArgs(GlobalItem typeSource, CodeTypeReference baseType)48         public TypeGeneratedEventArgs(GlobalItem typeSource, CodeTypeReference baseType)
49         {
50             this._typeSource = typeSource;
51             this._baseType = baseType;
52         }
53 
54         #endregion
55 
56         #region Properties
57 
58         public GlobalItem TypeSource
59         {
60             get
61             {
62                 return this._typeSource;
63             }
64         }
65 
66         /// <summary>
67         /// The type appropriate for the TypeSource
68         /// </summary>
69         public CodeTypeReference BaseType
70         {
71             get
72             {
73                 return this._baseType;
74             }
75             set
76             {
77                 this._baseType = value;
78             }
79         }
80 
81         /// <summary>
82         /// Interfaces to be included in the new type's definition
83         /// </summary>
84         public List<Type> AdditionalInterfaces
85         {
86             get
87             {
88                 return this._additionalInterfaces;
89             }
90         }
91 
92         /// <summary>
93         /// Members to be included in the new type's definition
94         /// </summary>
95         public List<CodeTypeMember> AdditionalMembers
96         {
97             get
98             {
99                 return this._additionalMembers;
100             }
101         }
102 
103         /// <summary>
104         /// Attributes to be added to the property's CustomAttributes collection
105         /// </summary>
106         public List<CodeAttributeDeclaration> AdditionalAttributes
107         {
108             get
109             {
110                 return this._additionalAttributes;
111             }
112         }
113 
114         #endregion
115     }
116 }
117