本文整理汇总了C#中System.Threading.Task.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# Task.Accept方法的具体用法?C# Task.Accept怎么用?C# Task.Accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Task
的用法示例。
在下文中一共展示了Task.Accept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCreateUpdateTask
public void TestCreateUpdateTask()
{
TaskEntity entity = new TaskEntity
{
TaskId = new TaskId(),
Initiator = new IdentityId().GetIdentity(),
Priority = Priority.Normal,
Status = TaskStatus.Created,
Created = DateTime.UtcNow,
Name = "Name",
Subject = "Subject"
};
Task task = new Task(entity)
{
LoggingService = new Mock<ILoggingService>().Object,
Priority = Priority.High
};
TaskDao dao=new TaskDao(SessionFactory);
task.Accept(dao);
//update priority
task.Priority = Priority.Medium;
task.Name = "New Name";
task.Subject = "New Subject";
task.Accept(dao);
task.AddComment("Bad comment");
task.AddComment("Good comment");
task.Accept(dao);
TrickVisitor visitor=new TrickVisitor
{
OnEntityVisit = e=>e.Version=1
};
task.Accept(visitor);
task.Name = "123";
task.Accept(dao);
}
示例2: TestPersistRoleAssignment
public void TestPersistRoleAssignment()
{
TaskEntity entity = new TaskEntity
{
TaskId = new TaskId(),
Initiator = new IdentityId().GetIdentity(),
Priority = Priority.Normal,
Status = TaskStatus.Created,
Created = DateTime.UtcNow,
Name = "Name",
Subject = "Subject"
};
Task task = new Task(entity)
{
LoggingService = new Mock<ILoggingService>().Object,
Priority = Priority.High
};
TaskDao dao = new TaskDao(SessionFactory);
task.Accept(dao);
task.PotentialOwners.Add(new IdentityId().GetIdentity());
task.PotentialOwners.Add(new IdentityId().GetIdentity());
task.Recepients.Add(new IdentityId().GetIdentity());
task.Recepients.Add(new IdentityId().GetIdentity());
task.Recepients.Add(new IdentityId().GetIdentity());
task.Recepients.Add(new IdentityId().GetIdentity());
task.BusinessAdministrators.Add(new IdentityId().GetIdentity());
task.Accept(dao);
using (ISession session = SessionFactory.OpenSession())
{
TaskEntity te = session.Query<TaskEntity>().Where(t => t.TaskId == entity.TaskId).FirstOrDefault();
}
}
示例3: TestTaskReady
public void TestTaskReady()
{
TaskEntity entity = new TaskEntity
{
TaskId = new TaskId(),
Initiator = new IdentityId().GetIdentity(),
Priority = Priority.Normal,
Status = TaskStatus.Created,
Created = DateTime.UtcNow,
Name = "Name",
Subject = "Subject"
};
Task task = new Task(entity)
{
LoggingService = new Mock<ILoggingService>().Object,
Priority = Priority.High
};
TaskDao dao = new TaskDao(SessionFactory);
task.Accept(dao);
Task loaded;
using (ISession session = SessionFactory.OpenSession())
{
TaskEntity te = session.Query<TaskEntity>().Where(t => t.TaskId == entity.TaskId).FirstOrDefault();
loaded=new Task(te);
}
Thread.GetDomain().SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
IPrincipal p = Thread.CurrentPrincipal;
loaded.Start();
task.Accept(dao);
loaded.Claim();
task.Accept(dao);
}