Как зарегистрировать пользовательский FileSystemBinaryLargeObject

Как настроить среду выполнения кода в odrder для подключения пользовательского класса, который наследуется от FileSystemBinaryLargeObject?

В нашем случае использования у нас есть объект с более чем 100 тыс. файлов. Мне нужно выяснить, как разбить их на подкаталоги.

Спасибо


person Dimitri    schedule 18.05.2016    source источник


Ответы (2)


Для всех сущностей:

<configuration>
 <configSections>
   <section name="MyDefaultNamespace" type="CodeFluent.Runtime.CodeFluentConfigurationSectionHandler, CodeFluent.Runtime" />
 </configSections>
 <MyDefaultNamespace ... other attributes ...
  binaryServicesTypeName="CustomBinaryServices, Assembly"
  binaryServicesEntityConfigurationTypeName="CustomBinaryServicesConfiguration, Assembly"
  />
</configuration>

Для конкретного объекта:

<configuration>
 <configSections>
   <section name="MyDefaultNamespace" type="CodeFluent.Runtime.CodeFluentConfigurationSectionHandler, CodeFluent.Runtime" />
 </configSections>
 <MyDefaultNamespace ... other attributes ... >
   <binaryServices entityFullTypeName="MyDefaultNamespace.MyNamespace.MyEntity"
     binaryServicesTypeName="CustomBinaryServices, Assembly" 
     binaryServicesEntityConfigurationTypeName="CustomBinaryServicesConfiguration, Assembly"/>
 </MyDefaultNamespace>
</configuration>
person meziantou    schedule 19.05.2016

Я считаю, что то, что вы предлагаете, не работает. Я протестировал его, чтобы увидеть, что мой пользовательский класс больших двоичных объектов не создается.

В соответствии с приведенным ниже кодом атрибут @binaryServicesTypeName принимает только 4 предопределенных строковых значения: azure, azure2, filesystem, skydrive.

В противном случае устанавливается объект большого двоичного объекта по умолчанию "SqlServerBinaryLargeObject".

/// <summary>
/// Gets or sets the type name of the class deriving from the BinaryLargeObject class.
///             Based on the 'typeName' Xml attributes from the configuration file.
///             The default is SqlServerBinaryLargeObject.
/// 
/// </summary>
/// 
/// <value>
/// The configured type name.
/// </value>
public virtual string TypeName
{
  get
  {
    if (this._typeName == null)
    {
      string defaultValue = (string) null;
      if (this._configuration.PersistenceHook != null)
        defaultValue = this._configuration.PersistenceHook.BinaryLargeObjectTypeName;
      if (string.IsNullOrEmpty(defaultValue))
        defaultValue = typeof (SqlServerBinaryLargeObject).AssemblyQualifiedName;
      this._typeName = XmlUtilities.GetAttribute((XmlNode) this.Element, "binaryServicesTypeName", defaultValue);
      if (this._typeName == null)
        this._typeName = XmlUtilities.GetAttribute((XmlNode) this.Element, "typeName", defaultValue);
      if (this._typeName != null && string.Compare(this._typeName, "azure", StringComparison.OrdinalIgnoreCase) == 0)
        this._typeName = "CodeFluent.Runtime.Azure.AzureBinaryLargeObject, CodeFluent.Runtime.Azure";
      if (this._typeName != null && string.Compare(this._typeName, "azure2", StringComparison.OrdinalIgnoreCase) == 0)
        this._typeName = "CodeFluent.Runtime.Azure.AzureBinaryLargeObject, CodeFluent.Runtime.Azure2";
      if (this._typeName != null && string.Compare(this._typeName, "filesystem", StringComparison.OrdinalIgnoreCase) == 0)
        this._typeName = typeof (FileSystemBinaryLargeObject).AssemblyQualifiedName;
      if (this._typeName != null && string.Compare(this._typeName, "skydrive", StringComparison.OrdinalIgnoreCase) == 0)
        this._typeName = typeof (SkyDriveBinaryLargeObject).AssemblyQualifiedName;
    }
    return this._typeName;
  }
  set
  {
    this._typeName = value;
  }
}

другие идеи?

PS: вот демонстрационный файл app.config, использующий сгенерированную схему для среды выполнения codefluent

app.config

person Dimitri    schedule 19.05.2016