1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
//---------------------------------------------------------------------
// <copyright file="PropertyGeneratedEventArgs.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// @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
{
/// <summary>
/// This class encapsulates the EventArgs dispatched as part of the event
/// raised when a property is generated.
/// </summary>
public sealed class PropertyGeneratedEventArgs : EventArgs
{
#region Private Data
private MetadataItem _propertySource;
private string _backingFieldName;
private CodeTypeReference _returnType;
private List<CodeStatement> _additionalGetStatements = new List<CodeStatement>();
private List<CodeStatement> _additionalSetStatements = new List<CodeStatement>();
private List<CodeAttributeDeclaration> _additionalAttributes = new List<CodeAttributeDeclaration>();
#endregion
#region Constructors
/// <summary>
/// Default constructor
/// </summary>
public PropertyGeneratedEventArgs()
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="propertySource">The event source</param>
/// <param name="backingFieldName">The name of the field corresponding to the property</param>
/// <param name="returnType">The property return type</param>
public PropertyGeneratedEventArgs(MetadataItem propertySource,
string backingFieldName,
CodeTypeReference returnType)
{
this._propertySource = propertySource;
this._backingFieldName = backingFieldName;
this._returnType = returnType;
}
#endregion
#region Properties
/// <summary>
/// The Metadata object that is the source of the property
/// </summary>
public MetadataItem PropertySource
{
get
{
return this._propertySource;
}
}
/// <summary>
/// The name of the field that backs the property; can be null in the case of
/// navigation property
/// </summary>
public string BackingFieldName
{
get
{
return this._backingFieldName;
}
}
/// <summary>
/// The type of the property by default; if changed by the user, the new value
/// will be used by the code generator
/// </summary>
public CodeTypeReference ReturnType
{
get
{
return this._returnType;
}
set
{
this._returnType = value;
}
}
/// <summary>
/// Statements to be included in the property's getter
/// </summary>
public List<CodeStatement> AdditionalGetStatements
{
get
{
return this._additionalGetStatements;
}
}
/// <summary>
/// Statements to be included in the property's setter
/// </summary>
public List<CodeStatement> AdditionalSetStatements
{
get
{
return _additionalSetStatements;
}
}
/// <summary>
/// Attributes to be added to the property's CustomAttributes collection
/// </summary>
public List<CodeAttributeDeclaration> AdditionalAttributes
{
get
{
return this._additionalAttributes;
}
}
#endregion
}
}
|