Пример #1
0
        public void EntityExportTest()
        {
            var dsrc = DataSource.GetInitialDataSource(_ctx.AppId);
            var entityModel = dsrc[Constants.DefaultStreamName].List[317];

            var export = new XmlExport(_ctx);
            var entityXElement = export.GetEntityXElement(entityModel);
            Debug.Write(entityXElement);
        }
Пример #2
0
        public void EntityImportTest()
        {
            // Export an Entity as XML
            var dsrc = DataSource.GetInitialDataSource(_ctx.AppId);
            var entityModel = dsrc[Constants.DefaultStreamName].List[317];
            var export = new XmlExport(_ctx);
            var entityXElement = export.GetEntityXElement(entityModel);

            // Import the Entity from XML
            var xmlImport = new XmlImport();
            //var importEntity = xmlImport.GetImportEntity(entityXElement, entityModel.AssignmentObjectTypeId);

            //// Actually Import the Entity as a new one, so create a new Guid
            //importEntity.EntityGuid = Guid.NewGuid();
            //var import = new Import.Import(_ctx.ZoneId, _ctx.AppId, "EntityImportTest");
            //import.RunImport(null, new List<Import.Entity> {importEntity});
        }
Пример #3
0
        /// <summary>
        /// Persist modified Entity to DataTimeline
        /// </summary>
        internal void SaveEntityToDataTimeline(Entity currentEntity)
        {
            var export = new XmlExport(Context);
            var entityModelSerialized = export.GetEntityXElementUncached(currentEntity.EntityID);
            var timelineItem = new DataTimelineItem
            {
                SourceTable = "ToSIC_EAV_Entities",
                Operation = Constants.DataTimelineEntityStateOperation,
                NewData = entityModelSerialized.ToString(),
                SourceGuid = currentEntity.EntityGUID,
                SourceID = currentEntity.EntityID,
                SysLogID = GetChangeLogId(),
                SysCreatedDate = DateTime.Now
            };
            Context.SqlDb.AddToDataTimeline(timelineItem);

            Context.SqlDb.SaveChanges();
        }