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


C# ISession.Load方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:27,代码来源:TaskDueTomorrowEmailSentCommand.cs

示例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;
 }
开发者ID:dblock,项目名称:dblog,代码行数:7,代码来源:TransitPostTopic.cs

示例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;
 }
开发者ID:dblock,项目名称:dblog,代码行数:7,代码来源:TransitPostImage.cs

示例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;
 }
开发者ID:dblock,项目名称:dblog,代码行数:7,代码来源:TransitPostLogin.cs

示例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;
 }
开发者ID:dblock,项目名称:dblog,代码行数:7,代码来源:TransitPostComment.cs

示例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;
 }
开发者ID:dblock,项目名称:dblog,代码行数:7,代码来源:TransitImageComment.cs

示例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();
            }               
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:28,代码来源:OffWorkReminderEmailSentCommand.cs

示例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);
 }
开发者ID:dblock,项目名称:dblog,代码行数:7,代码来源:ManagedLogin.cs

示例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");
            }
        }
开发者ID:jarrettmeyer,项目名称:portfolio-mvc,代码行数:27,代码来源:TaskMapTests.cs

示例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;
 }
开发者ID:dblock,项目名称:dblog,代码行数:8,代码来源:TransitReference.cs

示例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);
 }
开发者ID:minhajuddin,项目名称:playground,代码行数:8,代码来源:Program.cs

示例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;
			}

		}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:17,代码来源:TagService.cs

示例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;
 }
开发者ID:dblock,项目名称:dblog,代码行数:9,代码来源:TransitReferrerHostRollup.cs

示例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());
     }
 }
开发者ID:minhajuddin,项目名称:playground,代码行数:10,代码来源:Program.cs

示例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());
            }
        }
开发者ID:minhajuddin,项目名称:playground,代码行数:13,代码来源:Program.cs


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