本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}