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


C# IZetboxContext.Find方法代码示例

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


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

示例1: SubmitAndReload

 protected virtual void SubmitAndReload()
 {
     ctx.SubmitChanges();
     ctx = GetContext();
     aSide1 = ctx.Find<N_to_M_relations_A>(aSide1.ID);
     aSide2 = ctx.Find<N_to_M_relations_A>(aSide2.ID);
     bSide1 = ctx.Find<N_to_M_relations_B>(bSide1.ID);
     bSide2 = ctx.Find<N_to_M_relations_B>(bSide2.ID);
 }
开发者ID:daszat,项目名称:zetbox,代码行数:9,代码来源:NMTestFixture.cs

示例2: Reload

        protected virtual void Reload()
        {
            ctx = GetContext();
            identity1 = ctx.Find<Identity>(identity1.ID);
            identity2 = ctx.Find<Identity>(identity2.ID);

            parent = ctx.Find<SecurityTestParent>(parent.ID);
            child1 = ctx.Find<SecurityTestChild>(child1.ID);
            child2 = ctx.Find<SecurityTestChild>(child2.ID);
        }
开发者ID:daszat,项目名称:zetbox,代码行数:10,代码来源:AbstractSecurityTest.cs

示例3: SubmitAndReload

 protected void SubmitAndReload()
 {
     ctx.SubmitChanges();
     hasSubmitted = true;
     ctx = GetContext();
     oneSide1 = ctx.Find<One_to_N_relations_One>(oneSide1.ID);
     oneSide2 = ctx.Find<One_to_N_relations_One>(oneSide2.ID);
     oneSide3 = ctx.Find<One_to_N_relations_One>(oneSide3.ID);
     nSide1 = ctx.Find<One_to_N_relations_N>(nSide1.ID);
     nSide2 = ctx.Find<One_to_N_relations_N>(nSide2.ID);
 }
开发者ID:daszat,项目名称:zetbox,代码行数:11,代码来源:OneNFixture.cs

示例4: SubmitAndReload

 protected void SubmitAndReload()
 {
     ctx.SubmitChanges();
     hasSubmitted = true;
     ctx = GetContext();
     oneSide1 = ctx.Find<RequiredParent>(oneSide1.ID);
     oneSide2 = ctx.Find<RequiredParent>(oneSide2.ID);
     oneSide3 = ctx.Find<RequiredParent>(oneSide3.ID);
     nSide1 = ctx.Find<RequiredParentChild>(nSide1.ID);
     nSide2 = ctx.Find<RequiredParentChild>(nSide2.ID);
 }
开发者ID:daszat,项目名称:zetbox,代码行数:11,代码来源:RequiredParentFixture.cs

示例5: SetUp

        public override void SetUp()
        {
            base.SetUp();

            ctx = GetContext();
            var principalResolver = scope.Resolve<IPrincipalResolver>();

            var currentPrincipal = principalResolver.GetCurrent();

            Assert.That(currentPrincipal, Is.Not.Null, "No current identity found - try syncidentities or setup the current identity correctly");

            identity1 = ctx.Find<Identity>(currentPrincipal.ID);
            identity2 = ctx.GetQuery<Identity>().Where(i => i.ID != identity1.ID).First();

            parent = ctx.Create<SecurityTestParent>();
            parent.Name = "MyParent";

            child1 = ctx.Create<SecurityTestChild>();
            child1.Name = "Child1";
            child1.Identity = identity1;
            child1.Parent = parent;

            child2 = ctx.Create<SecurityTestChild>();
            child2.Name = "Child2";
            child2.Identity = identity2;
            child2.Parent = parent;

            ctx.SubmitChanges();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:29,代码来源:AbstractSecurityTest.cs

示例6: 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

示例7: InitTestObjects

 public void InitTestObjects()
 {
     ctx = GetContext();
     oneSide1 = ctx.Create<One_to_N_relations_One>();
     oneSide2 = ctx.Create<One_to_N_relations_One>();
     oneSide3 = ctx.Create<One_to_N_relations_One>();
     nSide1 = ctx.Create<One_to_N_relations_N>();
     nSide1.OneSide = oneSide3;
     nSide2 = ctx.Create<One_to_N_relations_N>();
     nSide2.OneSide = oneSide3;
     ctx.SubmitChanges();
     ctx = GetContext();
     oneSide1 = ctx.Find<One_to_N_relations_One>(oneSide1.ID);
     oneSide2 = ctx.Find<One_to_N_relations_One>(oneSide2.ID);
     oneSide3 = ctx.Find<One_to_N_relations_One>(oneSide3.ID);
     nSide1 = ctx.Find<One_to_N_relations_N>(nSide1.ID);
     nSide2 = ctx.Find<One_to_N_relations_N>(nSide2.ID);
 }
开发者ID:daszat,项目名称:zetbox,代码行数:18,代码来源:should_synchronize.cs

示例8: SubmitAndReload

 protected void SubmitAndReload()
 {
     ctx.SubmitChanges();
     ctx = GetContext();
     oneSide1 = ctx.Find<OrderedOneEnd>(oneSide1.ID);
     oneSide2 = ctx.Find<OrderedOneEnd>(oneSide2.ID);
     oneSide3 = ctx.Find<OrderedOneEnd>(oneSide3.ID);
     nSide1 = ctx.Find<OrderedNEnd>(nSide1.ID);
     nSide2 = ctx.Find<OrderedNEnd>(nSide2.ID);
     nSide3 = ctx.Find<OrderedNEnd>(nSide3.ID);
 }
开发者ID:daszat,项目名称:zetbox,代码行数:11,代码来源:OrderedOneNFixture.cs

示例9: GetSavedConfig

 private SavedListConfiguration GetSavedConfig(IZetboxContext ctx)
 {
     var config = ctx.GetQuery<SavedListConfiguration>()
         .Where(i => i.Type.ExportGuid == Parent.DataType.ExportGuid) // Parent.DataType might be from FrozenContext
         .Where(i => i.Owner.ID == this.CurrentPrincipal.ID)
         .FirstOrDefault();
     if (config == null)
     {
         config = ctx.Create<SavedListConfiguration>();
         config.Owner = ctx.Find<Identity>(CurrentPrincipal.ID);
         config.Type = ctx.FindPersistenceObject<ObjectClass>(Parent.DataType.ExportGuid);  // Parent.DataType might be from FrozenContext
     }
     return config;
 }
开发者ID:daszat,项目名称:zetbox,代码行数:14,代码来源:SavedListConfiguratorViewModel.cs

示例10: CreateTestData

        private void CreateTestData()
        {
            {
                srvCtx = scope.Resolve<IZetboxServerContext>();

                var grpAdmin = Zetbox.NamedObjects.Base.Groups.Administrator.Find(srvCtx);
                var grpEveryOne = Zetbox.NamedObjects.Base.Groups.Everyone.Find(srvCtx);

                // Create Identities
                admin = srvCtx.Create<Identity>();
                admin.DisplayName = "Administrator";
                admin.UserName = "<TestDomain>\\Administrator";
                admin.Groups.Add(grpAdmin);
                admin.Groups.Add(grpEveryOne);

                identity1 = srvCtx.Create<Identity>();
                identity1.DisplayName = "User 1";
                identity1.UserName = "<TestDomain>\\User1";
                identity1.Groups.Add(grpEveryOne);

                identity2 = srvCtx.Create<Identity>();
                identity2.DisplayName = "User 2";
                identity2.UserName = "<TestDomain>\\User2";
                identity2.Groups.Add(grpEveryOne);

                identity3_low = srvCtx.Create<Identity>();
                identity3_low.DisplayName = "User 3 with low privileges";
                identity3_low.UserName = "<TestDomain>\\User3";

                ma1 = srvCtx.Create<Mitarbeiter>();
                ma1.Name = identity1.DisplayName;
                ma1.Identity = identity1;

                ma2 = srvCtx.Create<Mitarbeiter>();
                ma2.Name = identity2.DisplayName;
                ma2.Identity = identity2;

                ma3_low = srvCtx.Create<Mitarbeiter>();
                ma3_low.Name = identity3_low.DisplayName;
                ma3_low.Identity = identity3_low;

                srvCtx.SubmitChanges();
            }

            {
                // Create 3 identity context
                var ctx = scope.Resolve<ServerZetboxContextFactory>().Invoke(identity1);

                // Create TestData with Identity 1
                prj1 = ctx.Create<Projekt>();
                prj1.Name = "Project User 1";
                prj1.Mitarbeiter.Add(ctx.Find<Mitarbeiter>(ma1.ID));
                CreateTasks(ctx, prj1);

                // Create TestData with Identity 1, common
                prjCommon = ctx.Create<Projekt>();
                prjCommon.Name = "Project Common";
                prjCommon.Mitarbeiter.Add(ctx.Find<Mitarbeiter>(ma1.ID));
                prjCommon.Mitarbeiter.Add(ctx.Find<Mitarbeiter>(ma2.ID));
                CreateTasks(ctx, prjCommon);

                ctx.SubmitChanges();

                prj1ID = prj1.ID;
                prjCommonID = prjCommon.ID;
            }

            {
                var ctx = scope.Resolve<ServerZetboxContextFactory>().Invoke(identity2);

                // Create TestData with Identity 2
                prj2 = ctx.Create<Projekt>();
                prj2.Name = "Project User 2";
                prj2.Mitarbeiter.Add(ctx.Find<Mitarbeiter>(ma2.ID));
                CreateTasks(ctx, prj2);
                ctx.SubmitChanges();

                prj2ID = prj2.ID;
            }

            id1Ctx = scope.Resolve<ServerZetboxContextFactory>().Invoke(identity1);
            id2Ctx = scope.Resolve<ServerZetboxContextFactory>().Invoke(identity2);
            id3Ctx_low = scope.Resolve<ServerZetboxContextFactory>().Invoke(identity3_low);

            prj1 = id1Ctx.Find<Projekt>(prj1ID);
            prjCommon = id1Ctx.Find<Projekt>(prjCommonID);
            prj2 = id2Ctx.Find<Projekt>(prj2ID);

            // Fix security tables
            // Own test checks if this works during object modifications too
            var connectionString = config.Server.GetConnectionString(Helper.ZetboxConnectionStringKey);
            using (var db = scope.ResolveNamed<ISchemaProvider>(connectionString.SchemaProvider))
            {
                db.Open(connectionString.ConnectionString);
                db.ExecRefreshRightsOnProcedure(db.GetProcedureName("projekte", "RefreshRightsOn_Projekte"));
                db.ExecRefreshRightsOnProcedure(db.GetProcedureName("projekte", "RefreshRightsOn_Tasks"));
                db.ExecRefreshRightsOnProcedure(db.GetProcedureName("projekte", "RefreshRightsOn_Auftraege"));
            }
        }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:99,代码来源:SecurityDataFixture.cs

示例11: ReloadObjects

 private void ReloadObjects(IZetboxContext reloadCtx)
 {
     one1 = reloadCtx.Find<One_to_N_relations_One>(one1.ID);
     one2 = reloadCtx.Find<One_to_N_relations_One>(one2.ID);
     n1 = reloadCtx.Find<One_to_N_relations_N>(n1.ID);
     n2 = reloadCtx.Find<One_to_N_relations_N>(n2.ID);
 }
开发者ID:daszat,项目名称:zetbox,代码行数:7,代码来源:when_changing_one_to_n.cs

示例12: GetDataObject

        public DataObjectViewModel GetDataObject(IZetboxContext ctx)
        {
            if (ctx == null) { throw new ArgumentNullException("ctx"); }

            IDataObject obj;

            if (ID <= Helper.INVALIDID)
            {
                obj = ctx.Create(ZetboxContextManagerModule.IftFactory(Type.GetSystemType()));
                ID = obj.ID;
            }
            else
            {
                obj = (IDataObject)ctx.Find(ZetboxContextManagerModule.IftFactory(Type.GetSystemType()), ID);
            }

            return DataObjectViewModel.Fetch(ZetboxContextManagerModule.ViewModelFactory, ctx, null, obj);
        }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:18,代码来源:JavaScriptObjectMoniker.cs

示例13: ActivateForeignItems

        protected void ActivateForeignItems(IViewModelFactoryScope newScope, IZetboxContext newCtx, IEnumerable<IDataObject> items)
        {
            if (newScope == null) throw new ArgumentNullException("newScope");
            if (newCtx == null) throw new ArgumentNullException("newCtx");
            if (items == null || items.Count() == 0) return;

            var newWorkspace = ObjectEditor.WorkspaceViewModel.Create(newScope.Scope, newCtx);
            newScope.ViewModelFactory.ShowModel(newWorkspace, RequestedWorkspaceKind, true);

            // ShowForeignObject may take a while
            newScope.ViewModelFactory.CreateDelayedTask(newWorkspace, () =>
            {
                var newViewModels = items.Select(i => DataObjectViewModel.Fetch(newScope.ViewModelFactory, newCtx, this, newCtx.Find(DataContext.GetInterfaceType(i), i.ID)));
                var openingArgs = new ItemsOpeningEventArgs(newCtx, newWorkspace, newViewModels);

                OnItemsOpening(newWorkspace, openingArgs);

                // abort handling the event if it is already handled
                if (openingArgs.Handled == true)
                    return;

                foreach (var newItem in openingArgs.Items)
                {
                    newWorkspace.ShowModel(newItem);
                }

                OnItemsOpened(newWorkspace, new ItemsOpenedEventArgs(openingArgs.Items));

                newWorkspace.SelectedItem = newWorkspace.Items.FirstOrDefault();
            }).Trigger();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:31,代码来源:CommonCommands.cs


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