Ejemplo n.º 1
0
        public void CreateDb()
        {
            var oid  = Guid.NewGuid();
            var doc1 = new Document()
            {
                DocumentName    = "Test_Document.doc",
                Owner           = "SQL",
                OidDocument     = oid,
                Path            = "root/SQL",
                DateCreated     = DateTime.Now,
                DateLastUpdated = DateTime.Now
            };

            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            byte[] bytes = encoding.GetBytes("this is the attachment");

            var atch1 = new Attachment()
            {
                DataField   = bytes,
                DateCreated = DateTime.Now,
                FileName    = "Test_Document.doc",
            };

            atch1.Document = doc1;

            using (var ctx = new FlowDocsEntities())
            {
                ctx.Attachments.Add(atch1);
                ctx.Documents.Add(doc1);
                ctx.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public void MyTestInitialize()
 {
     ctx = new FlowDocsEntities();
     adp = new FlowDocsContextAdapter(ctx);
     uow = new FlowDocsUnitOfWork(adp);
 }