本文整理汇总了C#中ISession.Load方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.Load方法的具体用法?C# ISession.Load怎么用?C# ISession.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(ISession session, long taskId, DateTime sentDate)
{
bool closeSession = false;
if (session == null)
{
session = _businessSafeSessionManager.Session;
closeSession = true;
}
var systemUser = session.Load<UserForAuditing>(SystemUser.Id);
var taskDueTomorrowEscalation = new EscalationTaskDueTomorrow()
{
TaskId = taskId,
TaskDueTomorrowEmailSentDate = sentDate,
CreatedBy = systemUser,
CreatedOn = DateTime.Now
};
session.Save(taskDueTomorrowEscalation);
//Log4NetHelper.Log.Debug("Saved EscalationTaskDueTomorrow sent indicator");
if (closeSession)
{
session.Close();
}
}
示例2: GetPostTopic
public PostTopic GetPostTopic(ISession session)
{
PostTopic ei = (Id != 0) ? (PostTopic)session.Load(typeof(PostTopic), Id) : new PostTopic();
ei.Topic = (Topic)session.Load(typeof(Topic), Topic.Id);
ei.Post = (Post)session.Load(typeof(Post), Post.Id);
return ei;
}
示例3: GetPostImage
public PostImage GetPostImage(ISession session)
{
PostImage ei = (Id != 0) ? (PostImage)session.Load(typeof(PostImage), Id) : new PostImage();
ei.Image = (Image)session.Load(typeof(Image), Image.Id);
ei.Post = (Post)session.Load(typeof(Post), Post.Id);
return ei;
}
示例4: GetPostLogin
public PostLogin GetPostLogin(ISession session)
{
PostLogin ei = (Id != 0) ? (PostLogin)session.Load(typeof(PostLogin), Id) : new PostLogin();
ei.Login = (Login)session.Load(typeof(Login), Login.Id);
ei.Post = (Post)session.Load(typeof(Post), Post.Id);
return ei;
}
示例5: GetPostComment
public PostComment GetPostComment(ISession session)
{
PostComment ei = (Id != 0) ? (PostComment)session.Load(typeof(PostComment), Id) : new PostComment();
ei.Comment = (Comment)session.Load(typeof(Comment), CommentId);
ei.Post = (Post)session.Load(typeof(Post), PostId);
return ei;
}
示例6: GetImageComment
public ImageComment GetImageComment(ISession session)
{
ImageComment ei = (Id != 0) ? (ImageComment)session.Load(typeof(ImageComment), Id) : new ImageComment();
ei.Comment = (Comment)session.Load(typeof(Comment), CommentId);
ei.Image = (Image)session.Load(typeof(Image), ImageId);
return ei;
}
示例7: Execute
public void Execute(ISession session, long accidentRecordId, DateTime sentDate)
{
bool closeSession = false;
if (session == null)
{
session = _businessSafeSessionManager.Session;
closeSession = true;
}
var systemUser = session.Load<UserForAuditing>(SystemUser.Id);
var offWorkReminderEscalation = new EscalationOffWorkReminder()
{
AccidentRecordId = accidentRecordId,
CreatedBy = systemUser,
CreatedOn = DateTime.Now,
OffWorkReminderEmailSentDate = DateTime.Now
};
session.Save(offWorkReminderEscalation);
//Log4NetHelper.Log.Debug("Saved EscalationOffWorkReminder sent indicator");
if (closeSession)
{
session.Close();
}
}
示例8: IsAdministrator
public static bool IsAdministrator(ISession session, string ticket)
{
if (string.IsNullOrEmpty(ticket)) return false;
int id = GetLoginId(ticket);
DBlog.Data.Login login = (DBlog.Data.Login)session.Load(typeof(DBlog.Data.Login), id);
return ((TransitLoginRole)Enum.Parse(typeof(TransitLoginRole), login.Role) == TransitLoginRole.Administrator);
}
示例9: Can_insert_a_new_task_with_a_category
public void Can_insert_a_new_task_with_a_category()
{
using (session = NHibernateConfig.SessionFactory.OpenSession())
{
tag = ObjectMother.NewTag;
tag.Description = "Test";
session.Save(tag);
session.Flush();
}
using (session = NHibernateConfig.SessionFactory.OpenSession())
{
task = ObjectMother.NewTask;
task.Tags.Add(tag);
session.Save(task);
session.Flush();
taskId = task.Id;
}
using (session = NHibernateConfig.SessionFactory.OpenSession())
{
task = session.Load<Task>(taskId);
task.Tags.Should().NotBeNull();
task.Tags.Count.Should().Be(1);
task.Tags.First().Description.Should().Be("Test");
}
}
示例10: GetReference
public Reference GetReference(ISession session)
{
Reference reference = (Id != 0) ? (Reference)session.Load(typeof(Reference), Id) : new Reference();
reference.Word = Word;
reference.Url = Url;
reference.Result = Result;
return reference;
}
示例11: LoadComplexUser
private static void LoadComplexUser(ISession session)
{
var user = session.Load<User>(2);
Print("Loading user");
Print("{0}", user);
Print("Printing Manager");
Print("{0}", user.CreatedBy);
}
示例12: GetTag
private Tag GetTag(ISession session, string name) {
try {
var tag = session.Load<Tag>(name);
if (name != tag.TagName)
tag = session.Load<Tag>(tag.TagName);
return tag;
} catch (ObjectNotFoundException) {
log.Warn("Tag not found: {0}", name);
return null;
}
}
示例13: GetReferrerHostRollup
public ReferrerHostRollup GetReferrerHostRollup(ISession session)
{
ReferrerHostRollup referrerhostrollup = (Id != 0)
? (ReferrerHostRollup) session.Load(typeof(ReferrerHostRollup), Id)
: new ReferrerHostRollup();
referrerhostrollup.Name = Name;
referrerhostrollup.Rollup = Rollup;
return referrerhostrollup;
}
示例14: LoadUsersFromRoleInAUser
private static void LoadUsersFromRoleInAUser(ISession session)
{
Print("loading user");
var user = session.Load<User>(1);
Print(user.ToString());
Print("users in the same role as current user");
foreach (User temp in user.Role.UsersInRole) {
Print(temp.ToString());
}
}
示例15: LoadRoleWithUser
private static void LoadRoleWithUser(ISession session)
{
var role = session.Load<Role>(1);
Print("Printing role info:");
Print(role.Description);
Print("Printint the users in this role");
foreach (User user in role.UsersInRole) {
Print(user.ToString());
}
}