diff --git a/CHANGELOG.md b/CHANGELOG.md index e7bc0a1..aa8b283 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [2.6.0] + +### Added +- +- Add new method to Initialize Files to support InMemory File Db - https://github.com/DynamicsValue/fake-xrm-easy/issues/157 + ## [2.5.0] ### Changed diff --git a/src/FakeXrmEasy.Abstractions/FakeXrmEasy.Abstractions.csproj b/src/FakeXrmEasy.Abstractions/FakeXrmEasy.Abstractions.csproj index 427bbb8..b147df0 100644 --- a/src/FakeXrmEasy.Abstractions/FakeXrmEasy.Abstractions.csproj +++ b/src/FakeXrmEasy.Abstractions/FakeXrmEasy.Abstractions.csproj @@ -7,7 +7,7 @@ net452 net452 FakeXrmEasy.Abstractions - 2.5.0 + 2.6.0 Jordi Montaña Dynamics Value FakeXrmEasy Abstractions diff --git a/src/FakeXrmEasy.Abstractions/FileStorage/IFIleAttachment.cs b/src/FakeXrmEasy.Abstractions/FileStorage/IFIleAttachment.cs new file mode 100644 index 0000000..a554798 --- /dev/null +++ b/src/FakeXrmEasy.Abstractions/FileStorage/IFIleAttachment.cs @@ -0,0 +1,40 @@ +using Microsoft.Xrm.Sdk; + +namespace FakeXrmEasy.Abstractions.FileStorage +{ + /// + /// Represents a file associated to an existing Dataverse record. + /// + public interface IFileAttachment + { + /// + /// The unique identifier of the file to be uploaded(i.e. the Guid of the fileattachment record) + /// + string Id { get; set; } + + /// + /// The file name, including the file extension + /// + string FileName { get; set; } + + /// + /// The file MIME type + /// + string MimeType { get; set; } + + /// + /// The actual file contents as a byte array + /// + byte[] Content { get; set; } + + /// + /// The associated record to which this file belongs + /// + EntityReference Target { get; set; } + + /// + /// The logical name of the File or Image column / field of the Target EntityReference + /// + string AttributeName { get; set; } + } +} \ No newline at end of file diff --git a/src/FakeXrmEasy.Abstractions/IXrmFakedContext.cs b/src/FakeXrmEasy.Abstractions/IXrmFakedContext.cs index 2896e7d..21938d5 100644 --- a/src/FakeXrmEasy.Abstractions/IXrmFakedContext.cs +++ b/src/FakeXrmEasy.Abstractions/IXrmFakedContext.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using FakeXrmEasy.Abstractions.FileStorage; namespace FakeXrmEasy.Abstractions { @@ -206,5 +207,11 @@ public interface IXrmFakedContext: IXrmBaseContext /// The entity logical name of the entity /// An early-bound record dif the context is already using early-bound entity records, a late bound entity otherwise Entity NewEntityRecord(string logicalName); + + /// + /// Initializes the context with a given state of pre-existing file uploads + /// + /// The list of files used to initialised the In-Memory File Storage. InitializeMetadata and Initialize must have been called prior to calling this method. + void InitializeFiles(IEnumerable files); } } \ No newline at end of file diff --git a/tests/FakeXrmEasy.Abstractions.Tests/FakeXrmEasy.Abstractions.Tests.csproj b/tests/FakeXrmEasy.Abstractions.Tests/FakeXrmEasy.Abstractions.Tests.csproj index cc3c1df..566ffa5 100644 --- a/tests/FakeXrmEasy.Abstractions.Tests/FakeXrmEasy.Abstractions.Tests.csproj +++ b/tests/FakeXrmEasy.Abstractions.Tests/FakeXrmEasy.Abstractions.Tests.csproj @@ -10,7 +10,7 @@ true FakeXrmEasy.AbstractionsTests - 2.5.0 + 2.6.0 Jordi Montaña Dynamics Value S.L. FakeXrmEasy Abstractions Tests @@ -28,6 +28,7 @@ + @@ -71,25 +72,28 @@ - + - + - + - + - + - + - + + + +