Parameter 要素 (CSDL)
概念スキーマ定義言語 (CSDL) の Parameter 要素は、FunctionImport 要素または Function 要素の子にすることができます。
FunctionImport 要素のアプリケーション
Parameter 要素 (FunctionImport 要素の子として) は、CSDL で宣言される関数インポートの入力パラメーターと出力パラメーターを定義するために使用されます。
The Parameter element can have the following child elements (in the order listed):
Documentation (0 または 1 つの要素を含めることができます)。
Annotation 要素 (0 個以上の要素を含めることができます)。
適用可能な属性
The following table describes the attributes that can be applied to the Parameter element.
属性名 | 必須 | Value |
---|---|---|
Name |
有効 |
パラメーターの名前。 |
Type |
有効 |
パラメーターの型。 値は EDMSimpleType であるか、モデルのスコープ内にある複合型でなければなりません。 詳細については、「概念モデルの型」を参照してください。 |
Mode |
いいえ |
パラメーターが入力パラメーター、出力パラメーター、または入力/出力パラメーターのいずれであるかに応じて、In、Out、または InOut です。 |
MaxLength |
いいえ |
パラメーターの許容最大長。 |
Precision |
いいえ |
パラメーターの有効桁数。 |
Scale |
いいえ |
パラメーターの小数点以下桁数。 |
注 : |
---|
Parameter 要素には、任意の数の annotation 属性 (カスタム XML 属性) を適用できます。However, custom attributes may not belong to any XML namespace that is reserved for CSDL.カスタム属性の完全修飾名は一意である必要があります。 |
例
次の例は、1 つの Parameter 子要素を持つ FunctionImport 要素を示しています。 関数は、1 つの入力パラメーターを受け取り、エンティティ型のコレクションを返します。
<FunctionImport Name="GetStudentGrades"
EntitySet="StudentGrade"
ReturnType="Collection(SchoolModel.StudentGrade)">
<Parameter Name="StudentID" Mode="In" Type="Int32" />
</FunctionImport>
Function 要素のアプリケーション
Parameter 要素 (Function 要素の子要素として) は、概念モデルで定義または宣言される関数のパラメーターを定義します。
The Parameter element can have the following child elements (in the order listed):
Documentation (0 個または 1 個の要素)
CollectionType (0 個または 1 個の要素)
ReferenceType (0 個または 1 個の要素)
RowType (0 個または 1 個の要素)
注 : |
---|
Property 要素の子要素にできるのは、CollectionType、ReferenceType、または RowType のうち 1 つだけです。 |
- Annotation 要素 (0 個以上の要素を含めることができます)。
注 : |
---|
Annotation 要素は、それ以外のすべての子要素より後に指定する必要があります。Annotation elements are only allowed in conceptual models for applications that target the .NET Framework version 4 or later.The XML namespace for such models is https://schemas.microsoft.com/ado/2008/09/edm. |
適用可能な属性
The following table describes the attributes that can be applied to the Parameter element.
属性名 | 必須 | Value |
---|---|---|
Name |
有効 |
パラメーターの名前。 |
Type |
いいえ |
パラメーターの型。 パラメーターには次のいずれかの型 (またはこれらの型のコレクション) を使用できます。
型の詳細については、「概念モデルの型」を参照してください。 |
Nullable |
いいえ |
プロパティに null 値を割り当てることができるかどうかにより、True (既定値) または False。 |
DefaultValue |
いいえ |
プロパティの既定値。 |
MaxLength |
いいえ |
プロパティ値の最大長。 |
FixedLength |
いいえ |
プロパティ値が固定長の文字列として格納されるかどうかにより、True または False。 |
Precision |
いいえ |
プロパティ値の有効桁数。 |
Scale |
いいえ |
プロパティ値の小数点以下桁数。 |
Unicode |
いいえ |
プロパティ値が Unicode 文字列として格納されるかどうかにより、True または False。 |
Collation |
いいえ |
データ ソースで使用する照合順序を指定する文字列。 |
注 : |
---|
Parameter 要素には、任意の数の annotation 属性 (カスタム XML 属性) を適用できます。However, custom attributes may not belong to any XML namespace that is reserved for CSDL.カスタム属性の完全修飾名は一意である必要があります。 |
例
次の例は、1 個の Parameter 子要素を使用して関数パラメーターを定義する Function 要素を示します。
<Function Name="GetYearsEmployed" ReturnType="Edm.Int32">
<Parameter Name="Instructor" Type="SchoolModel.Person" />
<DefiningExpression>
Year(CurrentDateTime()) - Year(cast(Instructor.HireDate as DateTime))
</DefiningExpression>
</Function>
参照
概念
エンティティ フレームワークの概要
CSDL 仕様
EntityContainer 要素 (CSDL)
その他のリソース
CSDL、SSDL、および MSL 仕様
ADO.NET Entity Data Model Tools
How to: Import a Stored Procedure
How to: Define Custom Functions in the Conceptual Model