Inheritance: System.Data.Objects.DataClasses.EntityObject
Example #1
0
 internal static void Map(AttachmentData source, Attachment destination)
 {
     destination.AttachmentId = source.AttachmentId;
     destination.FileData = source.FileData;
     destination.FileType = source.FileType;
     destination.IsArchived = source.IsArchived;
     destination.Name = source.Name;
     destination.SourceId = source.SourceId;
     destination.SourceTypeId = source.SourceTypeId;
     destination.CreatedBy = source.CreatedBy;
     destination.CreatedDate = source.CreatedDate;
     destination.ModifiedBy = source.ModifiedBy;
     destination.ModifiedDate = source.ModifiedDate;
 }
 /// <summary>
 /// Create a new Attachment object.
 /// </summary>
 /// <param name="attachmentId">Initial value of the AttachmentId property.</param>
 /// <param name="fileType">Initial value of the FileType property.</param>
 /// <param name="isArchived">Initial value of the IsArchived property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="sourceId">Initial value of the SourceId property.</param>
 /// <param name="sourceTypeId">Initial value of the SourceTypeId property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Attachment CreateAttachment(global::System.Int32 attachmentId, global::System.String fileType, global::System.Boolean isArchived, global::System.String name, global::System.Int32 sourceId, global::System.Int32 sourceTypeId, global::System.Int32 createdBy, global::System.DateTime createdDate, global::System.Int32 modifiedBy, global::System.DateTime modifiedDate)
 {
     Attachment attachment = new Attachment();
     attachment.AttachmentId = attachmentId;
     attachment.FileType = fileType;
     attachment.IsArchived = isArchived;
     attachment.Name = name;
     attachment.SourceId = sourceId;
     attachment.SourceTypeId = sourceTypeId;
     attachment.CreatedBy = createdBy;
     attachment.CreatedDate = createdDate;
     attachment.ModifiedBy = modifiedBy;
     attachment.ModifiedDate = modifiedDate;
     return attachment;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Attachments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAttachments(Attachment attachment)
 {
     base.AddObject("Attachments", attachment);
 }
        public AttachmentData Insert(AttachmentData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                           .GetManager(Database.ApplicationConnection, false))
            {
                var attachment = new Attachment();

                DataMapper.Map(data, attachment);

                ctx.ObjectContext.AddToAttachments(attachment);

                ctx.ObjectContext.SaveChanges();

                data.AttachmentId = attachment.AttachmentId;

                return data;
            }
        }
        private void Fetch(Attachment attachment, AttachmentData attachmentData)
        {
            DataMapper.Map(attachment, attachmentData);

            attachmentData.Source = new SourceData();
            DataMapper.Map(attachment.Source, attachmentData.Source);

            attachmentData.CreatedByUser = new UserData();
            DataMapper.Map(attachment.CreatedByUser, attachmentData.CreatedByUser);

            attachmentData.ModifiedByUser = new UserData();
            DataMapper.Map(attachment.ModifiedByUser, attachmentData.ModifiedByUser);
        }