public void SaveMessageAttachment(int messageId, string name, string type, int length, string attachmentContentType, byte[] attachmentContent)
        {
            var messageAttachment = new MessageAttachment
                {
                    MessageId = messageId,
                    FileName = name,
                    FileContent = attachmentContent,
                    FileLength = length,
                    FileType = type
                };

            Context.AddToMessageAttachments(messageAttachment);
            Context.SaveChanges();
        }
 /// <summary>
 /// Create a new MessageAttachment object.
 /// </summary>
 /// <param name="messageAttachmentId">Initial value of the MessageAttachmentId property.</param>
 /// <param name="fileName">Initial value of the FileName property.</param>
 /// <param name="fileContent">Initial value of the FileContent property.</param>
 /// <param name="fileType">Initial value of the FileType property.</param>
 /// <param name="fileLength">Initial value of the FileLength property.</param>
 public static MessageAttachment CreateMessageAttachment(global::System.Int32 messageAttachmentId, global::System.String fileName, global::System.Byte[] fileContent, global::System.String fileType, global::System.Int32 fileLength)
 {
     MessageAttachment messageAttachment = new MessageAttachment();
     messageAttachment.MessageAttachmentId = messageAttachmentId;
     messageAttachment.FileName = fileName;
     messageAttachment.FileContent = fileContent;
     messageAttachment.FileType = fileType;
     messageAttachment.FileLength = fileLength;
     return messageAttachment;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the MessageAttachments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMessageAttachments(MessageAttachment messageAttachment)
 {
     base.AddObject("MessageAttachments", messageAttachment);
 }