Peculiarities of using the method GetPropertyStorageName class Information

PstrfGetPropertyStorageName static method class [Information](fo_methods-class-information.html) allows you to [name of storage .Net-properties set by the attribute PropertyStorageAttribute`](fo_storing-data-objects.html).

Method without using the index

The method does not require specifying an index when you call, have the following form:

/// <param name="type">.Net class type of the data object</param> 
/// <param name="property">the property name</param> 
/// <returns>the name of the storage</returns> 
static public string GetPropertyStorageName(System.Type type, string property)

This method should be used if the property attribute is PropertyStorageAttribute is:

[PropertyStorage("TimeQu"))

Method using index

Method that requires an index when you call, have the following form:

/// <param name="type">.Net class type of the data object</param> 
/// <param name="property">the property name</param> 
/// <param name="index">the index to set</param> 
/// <returns>the name of the storage</returns> 
static public string GetPropertyStorageName(System.Type type, string property, int index)

This method should be used if the attribute Declaration properties PropertyStorageAttribute used an array of names:

PropertyStorage(new string[]) {"Postclass"}))

In this case, the parameter index will determine the element number of the array names specified in the attribute Declaration properties PropertyStorageAttribute, which will be returned by the method.

Erroneous Information.GetPropertyStorageName

  • If the attribute PropertyStorageAttribute was declared without an array, but use the call Information.GetPropertyStorageName index, an exception will be thrown.
  • If the attribute PropertyStorageAttribute was declared with an array, but use the call Information.GetPropertyStorageName without an index, then an empty string is returned.

Features of generation attribute properties PropertyStorage

  • Attribute Storage specified for the class properties, after generation will be presented in the form of attribute declarations PropertyStorage without the array.
  • Attributes Aggregator Storage dyelovoi links and Storage artisan links after generation will be presented in the form of attribute declarations PropertyStorage without the array, if the following conditions are met:
  • Storage-attribute contains only one nonempty value.
  • Attribute a typeusage contains more than one value.
Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru