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


C# DbSet.Find方法代码示例

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


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

示例1: FromRepositoryType

        public static WebHookSessionModel FromRepositoryType(WebHookSession model, DbSet<ComputerModel> computers)
        {
            var result = new WebHookSessionModel
            {
                Computer = computers.Find(model.Computer.Id),
                Id = model.Id,
                LastPing = model.LastPing,
                Token = model.Token,
            };

            return result;
        }
开发者ID:Mavtak,项目名称:roomie,代码行数:12,代码来源:WebHookSessionModel.cs

示例2: FromRepositoryType

        public static UserSessionModel FromRepositoryType(UserSession model, DbSet<UserModel> users)
        {
            var result = new UserSessionModel
            {
                CreationTimeStamp = model.CreationTimeStamp,
                Id = model.Id,
                LastContactTimeStamp = model.LastContactTimeStamp,
                Token = model.Token,
                User = users.Find(model.User.Id)
            };

            return result;
        }
开发者ID:Mavtak,项目名称:roomie,代码行数:13,代码来源:UserSessionModel.cs

示例3: FromRepositoryType

        public static NetworkModel FromRepositoryType(Network network, DbSet<ComputerModel> computers, DbSet<UserModel> users)
        {
            var result = new NetworkModel
            {
                Address = network.Address,
                AttatchedComputer = network.AttatchedComputer == null ? null : computers.Find(network.AttatchedComputer.Id),
                //TODO: include devices?,
                Id = network.Id,
                LastPing = network.LastPing,
                Name = network.Name,
                Owner = users.Find(network.Owner.Id)
            };

            return result;
        }
开发者ID:Mavtak,项目名称:roomie,代码行数:15,代码来源:NetworkModel.cs

示例4: FromRepositoryType

        public static TaskModel FromRepositoryType(Task model, DbSet<ComputerModel> computers,DbSet<ScriptModel> scripts, DbSet<UserModel> users)
        {
            var result = new TaskModel
            {
                Expiration = model.Expiration,
                Id = model.Id,
                Origin = model.Origin,
                Owner = users.Find(model.Owner.Id),
                ReceivedTimestamp = model.ReceivedTimestamp,
                Script = scripts.Find(model.Script.Id),
                Target = computers.Find(model.Target.Id)
            };

            return result;
        }
开发者ID:Mavtak,项目名称:roomie,代码行数:15,代码来源:TaskModel.cs

示例5: FromRepositoryType

        public static ComputerModel FromRepositoryType(Computer model, DbSet<ScriptModel> scripts, DbSet<UserModel> users)
        {
            var result = new ComputerModel
            {
                AccessKey = model.AccessKey,
                Address = model.Address,
                EncryptionKey = model.EncryptionKey,
                Id = model.Id,
                LastPing = model.LastPing,
                LastScript = model.LastScript == null ? null : scripts.Find(model.LastScript.Id),
                Name = model.Name,
                Owner = users.Find(model.Owner.Id)
            };

            return result;
        }
开发者ID:Mavtak,项目名称:roomie,代码行数:16,代码来源:ComputerModel.cs

示例6: FromRepositoryType

        public static DeviceModel FromRepositoryType(Device model, DbSet<NetworkModel> networks)
        {
            var result = new DeviceModel
            {
                Address = model.Address,
                CurrentAction = model.CurrentAction,
                Id = model.Id,
                IsConnected = model.IsConnected,
                LastPing = model.LastPing,
                Name = model.Name,
                Network = (model.Network == null) ? null : networks.Find(model.Network.Id),
                Notes = model.ToXElement().ToString(),
                Type = model.Type
            };

            return result;
        }
开发者ID:Mavtak,项目名称:roomie,代码行数:17,代码来源:DeviceModel.cs

示例7: AddGroups2

        static void AddGroups2(DbSet<ScenarioGroup> root, DateTime now)
        {
            ScenarioGroup sg1 = root.Find(2);

            ScenarioGroup sg = new ScenarioGroup();
            sg.StartTime = now.AddDays(-80);
            sg.EndTime = DateTime.MaxValue;
            sg.CreatedBy = "me";
            sg.CreatedAt = now;
            root.Add(sg);

            ScenarioGroupDetail sgd = new ScenarioGroupDetail();
            sgd.Name = "Test-Child-2";
            sgd.StartTime = now.AddDays(-80);
            sgd.EndTime = now.AddDays(-40);
            sgd.CreatedBy = "me";
            sgd.CreatedAt = now.AddDays(-40);
            sg.ScenarioGroupDetails.Add(sgd);

            sgd = new ScenarioGroupDetail();
            sgd.Name = "Test-Child-2";
            sgd.StartTime = now.AddDays(-40);
            sgd.EndTime = now.AddDays(-20);
            sgd.CreatedBy = "me";
            sgd.CreatedAt = now.AddDays(-20);
            sg.ScenarioGroupDetails.Add(sgd);

            sgd = new ScenarioGroupDetail();
            sgd.Name = "Test-Child-2";
            sgd.StartTime = now.AddDays(-20);
            sgd.EndTime = DateTime.MaxValue;
            sgd.CreatedBy = "me";
            sgd.CreatedAt = now.AddDays(-20);
            sg.ScenarioGroupDetails.Add(sgd);
        }
开发者ID:Juliusz,项目名称:Test,代码行数:35,代码来源:Program.cs


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