//--------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Data; using System.CodeDom; using System.Collections.Generic; using System.Data.Metadata.Edm; using System.Diagnostics; namespace System.Data.Entity.Design { /// /// This class encapsulates the EventArgs dispatched as part of the event /// raised when a property is generated. /// public sealed class PropertyGeneratedEventArgs : EventArgs { #region Private Data private MetadataItem _propertySource; private string _backingFieldName; private CodeTypeReference _returnType; private List _additionalGetStatements = new List(); private List _additionalSetStatements = new List(); private List _additionalAttributes = new List(); #endregion #region Constructors /// /// Default constructor /// public PropertyGeneratedEventArgs() { } /// /// Constructor /// /// The event source /// The name of the field corresponding to the property /// The property return type public PropertyGeneratedEventArgs(MetadataItem propertySource, string backingFieldName, CodeTypeReference returnType) { this._propertySource = propertySource; this._backingFieldName = backingFieldName; this._returnType = returnType; } #endregion #region Properties /// /// The Metadata object that is the source of the property /// public MetadataItem PropertySource { get { return this._propertySource; } } /// /// The name of the field that backs the property; can be null in the case of /// navigation property /// public string BackingFieldName { get { return this._backingFieldName; } } /// /// The type of the property by default; if changed by the user, the new value /// will be used by the code generator /// public CodeTypeReference ReturnType { get { return this._returnType; } set { this._returnType = value; } } /// /// Statements to be included in the property's getter /// public List AdditionalGetStatements { get { return this._additionalGetStatements; } } /// /// Statements to be included in the property's setter /// public List AdditionalSetStatements { get { return _additionalSetStatements; } } /// /// Attributes to be added to the property's CustomAttributes collection /// public List AdditionalAttributes { get { return this._additionalAttributes; } } #endregion } }