Цитата:
Сообщение от
Pandasama
Не обязательно, кстати - есть возможность настроить на хранение в БД.
Подозреваю, что в D365, с учетом её инфраструктуры, переход на хранение в БД полный.
Все с точностью до наоборот. Файлы не могут храниться в базе данных.
The database is not a supported storage location for files. Use a different location.
К слову, при миграции с Ax2012 надо сначала засосать файлы в базу данных, потом мигрировать ее, потом нажать на кнопку
Migrate files и выгрузить их опять, на этот раз в Blob Storage.
https://learn.microsoft.com/en-us/dy...hments-ax-2012
Работает примерно так:
X++:
class DocuFileMigrateDBtoAzure
{
public static void main(Args _args)
{
DocuValue docuValue;
DocuRef docuRef;
DocuType docType;
System.IO.Stream fileStream;
Microsoft.Dynamics.AX.Framework.FileManagement.DocumentLocation location;
Microsoft.Dynamics.AX.Framework.FileManagement.IDocumentStorageProvider storageProvider;
DataArea dataArea;
;
while select dataArea
{
changecompany(dataArea.id)
{
docType = null;
docType.skipTTSCheck(true);
while select forupdate docType
where docType.TypeGroup == DocuTypeGroup::File
{
if (docType.FilePlace == DocuFilePlace::Database)
{
docType.FilePlace = DocuFilePlace::Archive;
docType.update();
}
storageProvider = Docu::GetStorageProvider(docType, false, curUserId());
if (storageProvider == null)
continue;
while select forupdate docuValue
where docuValue.StorageProviderId == 0
&& docuValue.Type == DocuValueType::Others
join docuRef
where docuRef.ValueRecId == docuValue.RecId
&& docuRef.ActualCompanyId == docType.DataAreaId
&& docuRef.TypeId == docType.TypeId
{
fileStream = Binary::constructFromContainer(docuValue.File).getMemoryStream();
if (fileStream.Length == 0)
continue;
docuValue.FileId = newGuid();
location = storageProvider.SaveFile(
docuValue.FileId,
storageProvider.GenerateUniqueName(docuValue.OriginalFileName),
System.Web.MimeMapping::GetMimeMapping(docuValue.OriginalFileName),
fileStream);
fileStream.Close();
if (location == null)
continue;
if (location.NavigationUri)
{
docuValue.Path = location.get_NavigationUri().ToString();
}
if (location.AccessUri)
{
docuValue.AccessInformation = location.get_AccessUri().ToString();
}
docuValue.StorageProviderId = storageProvider.ProviderId;
docuValue.update();
}
}
}
}
}
}
Как можно видеть, никаких сетевых папок как понятия нет. Операции проводятся с in-memory потоками.