public void TestTempDeletedChildItemIgnored( )
        {
            var svc = new EntityInfoService( );

            EntityRef orgRef = null;

            try
            {
                var o = new Report
                {
                    Name  = "org rpt",
                    Alias = "shared:a" + Guid.NewGuid( )
                };

                var b = new ReportColumn
                {
                    Name            = "bob",
                    Alias           = "shared:a" + Guid.NewGuid( ),
                    ColumnForReport = o
                };

                EntityData result = svc.GetEntityData(b, EntityRequestHelper.BuildRequest("name, columnForReport.name"));

                result.Relationships[0].Instances[0].DataState = DataState.Delete;

                orgRef = svc.CreateEntity(result);
            }
            finally
            {
                if (orgRef != null)
                {
                    Entity.Delete(orgRef);
                }
            }
        }
예제 #2
0
 private void DeleteAccessRules(IList <string> typeNames, string aliasTemplate)
 {
     foreach (EntityRef entityToDelete in typeNames.Select(
                  tn => new EntityRef(string.Format(aliasTemplate, new EntityRef(tn).Alias))))
     {
         if (Entity.Exists(entityToDelete))
         {
             Entity.Delete(entityToDelete);
         }
     }
 }
예제 #3
0
        public void CleanUpEntities()
        {
            using (DatabaseContext context = DatabaseContext.GetContext(true))
            {
                using (new SecurityBypassContext())
                {
                    Role administratorRole;

                    administratorRole = Entity.Get <Role>(new EntityRef("core", "administratorRole"), true);
                    foreach (AccessRule entity in administratorRole.AllowAccess)
                    {
                        Entity.Delete(entity);
                    }

                    context.CommitTransaction();
                }
            }
        }
        public void DeleteInstance( )
        {
            // Define a new entity
            var data = new EntityData
            {
                Fields  = new List <FieldData>( ),
                TypeIds = new EntityRef("test", "person").ToEnumerable( ).ToList( )
            };

            data.Fields.Add(new FieldData
            {
                FieldId = new EntityRef("name"),
                Value   = new TypedValue("Isaac Newton")
            });

            // Create it
            var       svc = new EntityInfoService( );
            EntityRef id  = svc.CreateEntity(data);

            // Verify it was created
            Assert.IsTrue(id.Id > 0, "Positive Id");

            // Select the data
            EntityMemberRequest request = EntityRequestHelper.BuildRequest("name");
            EntityData          result  = svc.GetEntityData(id, request);

            // Verify results
            Assert.AreEqual("Isaac Newton", result.Fields[0].Value.Value);

            long entityId = id.Id;

            // Delete the entity
            Entity.Delete(id);

            var newRef = new EntityRef(entityId);

            result = svc.GetEntityData(newRef, request);
            Assert.IsNull(result);
        }