当前位置: 首页>>代码示例>>C#>>正文


C# IZetboxContext.Delete方法代码示例

本文整理汇总了C#中IZetboxContext.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# IZetboxContext.Delete方法的具体用法?C# IZetboxContext.Delete怎么用?C# IZetboxContext.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IZetboxContext的用法示例。


在下文中一共展示了IZetboxContext.Delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MakeInternal

 private static void MakeInternal(IZetboxContext ctx, ImportedFile obj, File doc)
 {
     // Clone blob, so it could be deleted
     doc.Blob = ctx.Find<Blob>(ctx.CreateBlob(ctx.GetFileInfo(obj.Blob.ID), obj.Blob.MimeType));
     doc.Name = obj.Name;
     ctx.Delete(obj);
 }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:7,代码来源:ImportedFileActions.cs

示例2: TearDown

 public override void TearDown()
 {
     ctx = GetContext();
     var tdObj = ctx.GetQuery<TestObjClass>().Where(a => a.ID == originalId);
     foreach (var o in tdObj.ToList())
     {
         ctx.Delete(o);
     }
     base.TearDown();
 }
开发者ID:daszat,项目名称:zetbox,代码行数:10,代码来源:when_submitting.cs

示例3: DeleteData

 /// <summary>
 /// Deletes all remaining test objects.
 /// </summary>
 /// <param name="ctx">this context is used to delete the objects</param>
 public static void DeleteData(IZetboxContext ctx)
 {
     ctx.GetQuery<Kunde>().ForEach(obj => ctx.Delete(obj));
     ctx.GetQuery<Auftrag>().ForEach(obj => ctx.Delete(obj));
     ctx.GetQuery<Task>().ForEach(obj => ctx.Delete(obj));
     ctx.GetQuery<Projekt>().ForEach(obj => { ctx.Delete(obj); });
     ctx.GetQuery<Mitarbeiter>().ForEach(obj => { ctx.Delete(obj); });
 }
开发者ID:daszat,项目名称:zetbox,代码行数:12,代码来源:ProjectDataFixture.cs

示例4: Deploy

        public static void Deploy(IZetboxContext ctx, params IPackageProvider[] providers)
        {
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (providers == null) { throw new ArgumentNullException("providers"); }

            using (Log.InfoTraceMethodCall("Deploy"))
            {
                Log.InfoFormat("Starting Deployment from {0}", string.Join(", ", providers.Select(p => p.ToString()).ToArray()));
                try
                {
                    // TODO: Das muss ich z.Z. machen, weil die erste Query eine Entity Query ist und noch nix geladen wurde....
                    var testObj = ctx.GetQuery<Zetbox.App.Base.ObjectClass>().FirstOrDefault();
                    Debug.WriteLine(testObj != null ? testObj.ToString() : String.Empty);
                }
                catch
                {
                    // Ignore
                }

                Dictionary<Guid, IPersistenceObject> currentObjects = new Dictionary<Guid, IPersistenceObject>();
                Log.Info("Loading namespaces");
                var names = providers.SelectMany(p => LoadModuleNames(p)).Distinct().ToList();
                if (names.Count == 0) throw new InvalidOperationException("No modules found in import file");

                foreach (var name in names)
                {
                    Log.InfoFormat("Prefetching objects for {0}", name);
                    var module = ctx.GetQuery<Zetbox.App.Base.Module>().FirstOrDefault(m => m.Name == name);
                    if (module != null)
                    {
                        foreach (var obj in PackagingHelper.GetMetaObjects(ctx, module))
                        {
                            currentObjects[((Zetbox.App.Base.IExportable)obj).ExportGuid] = obj;
                        }
                    }
                    else
                    {
                        Log.InfoFormat("Found new Module '{0}' in XML", name);
                    }
                }

                providers.ForEach(p => p.RewindData());
                Dictionary<Guid, IPersistenceObject> importedObjects = new Dictionary<Guid, IPersistenceObject>();
                Log.Info("Loading");

                foreach (var p in providers)
                {
                    var reader = p.Reader;
                    // Find Root Element
                    while (reader.Read() && reader.NodeType != XmlNodeType.Element && reader.LocalName != "ZetboxPackaging" && reader.NamespaceURI != "http://dasz.at/Zetbox") ;

                    // Read content
                    while (reader.Read())
                    {
                        if (reader.NodeType != XmlNodeType.Element) continue;
                        var obj = ImportElement(ctx, currentObjects, p);
                        if (obj == null) throw new InvalidOperationException("Invalid import format: ImportElement returned NULL");
                        importedObjects[((IExportableInternal)obj).ExportGuid] = obj;
                    }
                }

                Log.Info("Reloading References");
                foreach (var obj in importedObjects.Values)
                {
                    obj.ReloadReferences();
                }

                var objectsToDelete = currentObjects.Where(p => !importedObjects.ContainsKey(p.Key));
                Log.InfoFormat("Deleting {0} objects marked for deletion", objectsToDelete.Count());
                foreach (var pairToDelete in objectsToDelete)
                {
                    ctx.Delete(pairToDelete.Value);
                }
                Log.Info("Deployment finished");
            }
        }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:76,代码来源:Importer.cs

示例5: TearDown

        public override void TearDown()
        {
            ctx = GetContext();
            ReloadObjects(ctx);
            ctx.Delete(one1);
            ctx.Delete(one2);
            ctx.Delete(n1);
            ctx.Delete(n2);
            ctx.SubmitChanges();

            base.TearDown();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:12,代码来源:when_changing_one_to_n.cs

示例6: DoDelete

 private void DoDelete(IZetboxContext ctx, IDataObject obj)
 {
     var deactivatable = obj as IDeactivatable;
     if (deactivatable == null
         || (ctx.IsElevatedMode && ViewModelFactory.GetDecisionFromUser(CommonCommandsResources.DeleteDataObjectCommand_ElevatedDeleteDeactivated, CommonCommandsResources.DeleteDataObjectCommand_ElevatedDeleteDeactivated_Title)))
     {
         ctx.Delete(obj);
     }
     else
     {
         deactivatable.IsDeactivated = true;
     }
 }
开发者ID:daszat,项目名称:zetbox,代码行数:13,代码来源:CommonCommands.cs

示例7: ClearDestination

        /// <summary>
        /// Clears the destination zetbox tables. Due to FKs, ordering is required.
        /// </summary>
        private void ClearDestination(IZetboxContext ctx)
        {
            foreach (var log in ctx.GetQuery<MigrationLog>())
            {
                ctx.Delete(log);
            }
            ctx.SubmitChanges();

            // required ordering
            //executor.CleanDestination(tables["tbl_Cars"]);
            //executor.CleanDestination(tables["tbl_Customers"]);
        }
开发者ID:daszat,项目名称:zetbox,代码行数:15,代码来源:Program.cs


注:本文中的IZetboxContext.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。