DatabaseUtilsCreateFileContentBeforeConnectTransaction Method (IDatabaseRepository, String, Byte) |
Namespace: PDTec.IceNet.Sdk.Utils
public static string CreateFileContentBeforeConnectTransaction( IDatabaseRepository pRepository, string vaultName, byte[] aContent )
The example shows how to use the CreateFileContentBeforeConnectTransaction(IDatabaseRepository, String, Byte) method to create a file content and connect this file content in a database transaction.
byte[] aContent = Encoding.ASCII.GetBytes("1234567890"); // // First step: create a FileContent record... // string contentUuid = DatabaseUtils.CreateFileContentBeforeConnectTransaction(Repository, "System.Database", aContent); // // Final step: Create the File object and connect the FileContent as a new content version... // IFile pFile = null; Repository.ExecuteTransaction(delegate { pFile = Repository.GetObjTypeByName("Core.File").Create<IFile>(Repository.RootFolder, "F1", ""); pFile.ConnectContent(true, "", "test.txt", contentUuid); });