/// <summary>
 /// Create a new ContentFile object.
 /// </summary>
 /// <param name="fileID">Initial value of the FileID property.</param>
 /// <param name="portalID">Initial value of the PortalID property.</param>
 /// <param name="isDirectory">Initial value of the IsDirectory property.</param>
 /// <param name="upsize_ts">Initial value of the upsize_ts property.</param>
 public static ContentFile CreateContentFile(global::System.Int32 fileID, global::System.Int32 portalID, global::System.Boolean isDirectory, global::System.Byte[] upsize_ts)
 {
     ContentFile contentFile = new ContentFile();
     contentFile.FileID = fileID;
     contentFile.PortalID = portalID;
     contentFile.IsDirectory = isDirectory;
     contentFile.upsize_ts = upsize_ts;
     return contentFile;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the ContentFiles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToContentFiles(ContentFile contentFile)
 {
     base.AddObject("ContentFiles", contentFile);
 }
示例#3
0
        public void CreateItem(string name, string path, string mimeType, bool isDirectory, long size, byte[] content)
        {
            int parentId = GetItemId(path);
            if (parentId < 0)
            {
                return;
            }

            using (EntitiesContext context = new EntitiesContext())
            {
                ContentFile I = new ContentFile
                {
                    Name = name,
                    ParentID = parentId,
                    MimeType = mimeType,
                    IsDirectory = isDirectory,
                    Size = int.Parse(size.ToString()),
                    FileContent = content,
                    PortalID = this.PortalID
                };
                context.ContentFiles.AddObject(I);
                context.SaveChanges();
            }

            _data = null;
        }