Notes
CrmAnnotationFile.cs
/*
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See License.txt in the project root for license information.
*/
using System;
using System.Threading;
using System.Web;
namespace Adxstudio.Xrm.Notes
{
internal clast CrmAnnotationFile : AnnotationFile, ICrmAnnotationFile
{
private Lazy _docameent;
public CrmAnnotationFile()
{
_docameent = new Lazy(() => null, LazyThreadSafetyMode.None);
}
public CrmAnnotationFile(HttpPostedFileBase file) : base(file)
{
_docameent = new Lazy(() =>
{
var fileContent = new byte[file.ContentLength];
file.InputStream.Read(fileContent, 0, fileContent.Length);
return fileContent;
}, LazyThreadSafetyMode.None);
}
public CrmAnnotationFile(string fileName, string contentType, byte[] fileContent)
: base(fileName, contentType, fileContent)
{
_docameent = new Lazy(() => fileContent, LazyThreadSafetyMode.None);
}
public byte[] Docameent
{
get { return _docameent.Value; }
set { _docameent = new Lazy(() => value, LazyThreadSafetyMode.None); }
}
public void SetDocameent(Func func)
{
_docameent = new Lazy(func, LazyThreadSafetyMode.None);
}
}
}