• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ISession的典型用法代码示例。如果您正苦于以下问题:C# ISession类的具体用法?C# ISession怎么用?C# ISession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ISession类属于命名空间,在下文中一共展示了ISession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: CreatePurchaseRCV

        public static RCVHead CreatePurchaseRCV(ISession session, int userId, string poNumber, string note)
        {
            RCVHead head = new RCVHead();
            head._refOrderType = head._originalOrderType = POHead.ORDER_TYPE;
            head._refOrderNumber = head._orginalOrderNumber = poNumber.Trim().ToUpper();
            #region ���
            //��ʱ������ɹ��ջ����������òɹ������ķ�ʽ
            if (string.IsNullOrEmpty(head._refOrderNumber))
                throw new Exception("�ɹ�����Ϊ��");
            POHead po = POHead.Retrieve(session, head._refOrderNumber);
            if (po == null)
                throw new Exception(string.Format("�ɹ�����{0}������", head._refOrderNumber));
            if (po.Status != POStatus.Release)
                throw new Exception(string.Format("�ɹ�����{0}���Ƿ���״̬�������Խ����ջ���ҵ", head._refOrderNumber));
            if (po.ApproveResult != ApproveStatus.Approve)
                throw new Exception(string.Format("�ɹ�����{0}��û�����ǩ�ˣ������Խ����ջ���ҵ", head._refOrderNumber));
            #endregion
            head._orderTypeCode = RCVHead.ORD_TYPE_PUR;
            head._orderNumber = ERPUtil.NextOrderNumber(head._orderTypeCode);
            head._objectID = po.VendorID;
            head._locationCode = po.LocationCode;
            head._createUser = userId;
            head._note = note.Trim();
            EntityManager.Create(session, head);

            return head;
        }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:27,代码来源:RCVHeadImpl.cs


示例3: RecreateDb

 public void RecreateDb(ISession session)
 {
     InitSessionFactory();
     var sessionSource = new SessionSource(_fluentConfiguration);
     sessionSource.BuildSchema(session);
     session.Flush();
 }
开发者ID:saitodisse,项目名称:aspnet-webapi-knockout-restfull,代码行数:7,代码来源:NhCastle.cs


示例4: HandleEvent

 public void HandleEvent(EggIncubatorStatusEvent evt, ISession session)
 {
     Logger.Write(evt.WasAddedNow
         ? session.Translation.GetTranslation(TranslationString.IncubatorPuttingEgg, evt.KmRemaining)
         : session.Translation.GetTranslation(TranslationString.IncubatorStatusUpdate, evt.KmRemaining),
         LogLevel.Egg);
 }
开发者ID:Roywaller,项目名称:NecroBot,代码行数:7,代码来源:ConsoleEventListener.cs


示例5: IsExistsCode

        private void IsExistsCode(ISession session, Storehouse sh)
        {
            ICriteria criteria = session.CreateCriteria(typeof(Storehouse));

            ICriterion criterion = null;
            if (sh.Id != Guid.Empty)
            {
                criterion = Restrictions.Not(Restrictions.IdEq(sh.Id));
                criteria.Add(criterion);
            }

            criterion = Restrictions.Eq("StoreCode", sh.StoreCode);
            criteria.Add(criterion);
            //统计
            criteria.SetProjection(
                Projections.ProjectionList()
                .Add(Projections.Count("Id"))
                );

            int count = (int)criteria.UniqueResult();
            if (count > 0)
            {
                throw new EasyJob.Tools.Exceptions.StorehouseCodeIsExistsException();//库存Code已经存在
            }
        }
开发者ID:iEasyJob,项目名称:EasyJob,代码行数:25,代码来源:StorehouseController.cs


示例6: ChangeCommitted

        internal static bool ChangeCommitted(this ISessionPersistentObject al,CRUD Operation, IImportContext iic,  ISession session)
        {
            if (al == null)
                throw new Exception("Algo Error");

            bool needtoregister = false;

            IObjectStateCycle oa = al;

            switch (Operation)
            {
                case CRUD.Created:
                    needtoregister = true;
                    session.Save(al);
                    break;

                case CRUD.Update:
                    session.Update(al);         
                    oa.HasBeenUpdated();
                    break;

                case CRUD.Delete:
                    session.Delete(al);
                    oa.SetInternalState(ObjectState.Removed,iic);
                    break;
            }

            al.Context = null;

            return needtoregister;
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:31,代码来源:ISessionObjectExtension.cs


示例7: Set

 public void Set(ISession value)
 {
     if (value != null)
     {
         HttpContext.Current.Items.Add("NhbSession", value);
     }
 }
开发者ID:276398084,项目名称:KW.OrderManagerSystem,代码行数:7,代码来源:HttpSessionStorage.cs


示例8: Store

 public void Store(ISession session)
 {
     if (_nhSessions.Contains(GetThreadName()))
         _nhSessions[GetThreadName()] = session;
     else
         _nhSessions.Add(GetThreadName(), session);
 }
开发者ID:Defcoq,项目名称:Enterprise.Dev.Best.Practices,代码行数:7,代码来源:ThreadSessionStorageContainer.cs


示例9: session_MessageToUser

 void session_MessageToUser(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(delegate()
         {
             CF_displayMessage(e.Message);
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:7,代码来源:Spotify.Session.cs


示例10: SessionAccess

        public SessionAccess(ISession session)
        {
            if (session == null)
                throw new ArgumentNullException("session");

            this.session = session;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:SessionAccess.cs


示例11: EmployeeRepository

        public EmployeeRepository(ISession session)
        {
            if (session == null)
                throw new ArgumentNullException("session");

                this.session = session;
        }
开发者ID:pjmagee,项目名称:DemoExercise,代码行数:7,代码来源:EmployeeRepository.cs


示例12: getExistingOrNewSession

        private ISession getExistingOrNewSession(NHibernate.ISessionFactory factory)
        {
            if (HttpContext.Current != null)
            {
                ISession session = GetExistingWebSession();
                if (session == null)
                {
                    session = openSessionAndAddToContext(factory);
                }
                else if (!session.IsOpen)
                {
                    session = openSessionAndAddToContext(factory);
                }

                return session;
            }

            if (currentSession == null)
            {
                currentSession = factory.OpenSession();
            }
            else if (!currentSession.IsOpen)
            {
                currentSession = factory.OpenSession();
            }

            return currentSession;
        }
开发者ID:TimBarcz,项目名称:groop,代码行数:28,代码来源:HybridSessionBuilder.cs


示例13: RegionRepository

 public RegionRepository(ISession session)
 {
     DataTable table;
     _ds = new DataSet("Province");
     DataSet p = session.CreateObjectQuery("select PRV_ID as Province_ID,PRV_CODE as \"Code\",PRV_NAME as \"Name\",PRV_ALIAS as \"Alias\" from Province")
         .Attach(typeof(Province))
         .DataSet();
     table = p.Tables[0];
     table.TableName = "p";
     table.Constraints.Add("PK_p", table.Columns["Province_ID"], true);
     p.Tables.Clear();
     _ds.Tables.Add(table);
     DataSet c = session.CreateObjectQuery("select PRV_ID as Province_ID,CITY_ID as City_ID,CITY_CODE as City_Code,CITY_NAME as \"Name\" from City")
         .Attach(typeof(City))
         .DataSet();
     table = c.Tables[0];
     table.TableName = "c";
     table.Constraints.Add("PK_c", table.Columns["City_ID"], true);
     c.Tables.Clear();
     _ds.Tables.Add(table);
     DataSet d = session.CreateObjectQuery("select CITY_ID as City_ID,DST_ID as District_ID,DST_NAME as \"Name\",DST_ZIPCODE as Zip_Code,DST_SHIP_TO as Door2Door from District")
         .Attach(typeof(District))
         .DataSet();
     table = d.Tables[0];
     table.TableName = "d";
     table.Constraints.Add("PK_d", table.Columns["District_ID"], true);
     d.Tables.Clear();
     _ds.Tables.Add(table);
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:29,代码来源:RegionRepository.cs


示例14: GetAllICQInfo

        /// <summary>
        /// Requests a full set of information about an ICQ account
        /// </summary>
        /// <param name="sess">A <see cref="ISession"/> object</param>
        /// <param name="screenname">The account for which to retrieve information</param>
        public static void GetAllICQInfo(ISession sess, string screenname)
        {
            if (!ScreennameVerifier.IsValidICQ(screenname))
            {
                throw new ArgumentException(screenname + " is not a valid ICQ screenname", "screenname");
            }

            SNACHeader sh = new SNACHeader();
            sh.FamilyServiceID = (ushort) SNACFamily.ICQExtensionsService;
            sh.FamilySubtypeID = (ushort) ICQExtensionsService.MetaInformationRequest;
            sh.Flags = 0x0000;
            sh.RequestID = Session.GetNextRequestID();

            ByteStream stream = new ByteStream();
            stream.WriteUshort(0x0001);
            stream.WriteUshort(0x000A);
            stream.WriteUshort(0x0008);
            stream.WriteUint(uint.Parse(sess.ScreenName));
            stream.WriteUshortLE(0x07D0);
            stream.WriteUshortLE((ushort) sh.RequestID);
            stream.WriteUshort(0x04B2);
            stream.WriteUint(uint.Parse(screenname));

            SNACFunctions.BuildFLAP(Marshal.BuildDataPacket(sess, sh, stream));
        }
开发者ID:pkt30,项目名称:OscarLib,代码行数:30,代码来源:SNAC15.cs


示例15: turnOnStatistics

 private static bool turnOnStatistics(ISession session)
 {
     var onOff = session.SessionFactory.Statistics.IsStatisticsEnabled;
     session.SessionFactory.Statistics.IsStatisticsEnabled = true;
     session.SessionFactory.Statistics.Clear();
     return onOff;
 }
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:Fixture.cs


示例16: SessionHandler

        public SessionHandler(ILogger<SessionHandler> logger,
            IEnvironment environment,
            IFileSystem fileSystem,
            IKeyValueStore keyValueStore,
            IMessageBus messageBus,
            ISession session,
            ITorrentInfoRepository torrentInfoRepository,
            ITorrentMetadataRepository metadataRepository)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (environment == null) throw new ArgumentNullException("environment");
            if (fileSystem == null) throw new ArgumentNullException("fileSystem");
            if (keyValueStore == null) throw new ArgumentNullException("keyValueStore");
            if (messageBus == null) throw new ArgumentNullException("messageBus");
            if (session == null) throw new ArgumentNullException("session");
            if (torrentInfoRepository == null) throw new ArgumentNullException("torrentInfoRepository");
            if (metadataRepository == null) throw new ArgumentNullException("metadataRepository");

            _logger = logger;
            _environment = environment;
            _fileSystem = fileSystem;
            _keyValueStore = keyValueStore;
            _messageBus = messageBus;
            _session = session;
            _torrentInfoRepository = torrentInfoRepository;
            _metadataRepository = metadataRepository;
            _muted = new List<string>();
            _alertsThread = new Thread(ReadAlerts);
        }
开发者ID:originalmoose,项目名称:hadouken,代码行数:29,代码来源:SessionHandler.cs


示例17: GetInsertAction

 public Action GetInsertAction(ISession session, object bindableStatement, ConsistencyLevel consistency, int rowsPerId)
 {
     Action action = () =>
     {
         Trace.TraceInformation("Starting inserting from thread {0}", Thread.CurrentThread.ManagedThreadId);
         var id = Guid.NewGuid();
         for (var i = 0; i < rowsPerId; i++)
         {
             var paramsArray = new object[] { id, DateTime.Now, DateTime.Now.ToString() };
             IStatement statement = null;
             if (bindableStatement is SimpleStatement)
             {
                 statement = ((SimpleStatement)bindableStatement).Bind(paramsArray).SetConsistencyLevel(consistency);
             }
             else if (bindableStatement is PreparedStatement)
             {
                 statement = ((PreparedStatement)bindableStatement).Bind(paramsArray).SetConsistencyLevel(consistency);
             }
             else
             {
                 throw new Exception("Can not bind a statement of type " + bindableStatement.GetType().FullName);
             }
             session.Execute(statement);
         }
         Trace.TraceInformation("Finished inserting from thread {0}", Thread.CurrentThread.ManagedThreadId);
     };
     return action;
 }
开发者ID:rasmus-s,项目名称:csharp-driver,代码行数:28,代码来源:StressTests.cs


示例18: session_PlayTokenLost

 void session_PlayTokenLost(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(delegate()
         {
             CF_displayMessage("Play token lost! What do we do???" + Environment.NewLine + e.Status.ToString() + Environment.NewLine + e.Message);
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:7,代码来源:Spotify.Session.cs


示例19: CreateVoyages

 public static void CreateVoyages(ISession session)
 {
    session.Save(V100);
    session.Save(V200);
    session.Save(V300);
    session.Save(V400);
 }
开发者ID:ssajous,项目名称:DDDSample.Net,代码行数:7,代码来源:SampleVoyages.cs


示例20: Login

        public async Task<LoginResult> Login(ISession session)
        {
            string username = null;
            bool isUsernameValid = false;

            while (!isUsernameValid)
            {
                await session.SendAsync("Please enter your username:");

                username = await session.ReceiveAsync();

                if (username == null)
                {
                    return LoginResult.Fail;
                }

                isUsernameValid = !string.IsNullOrWhiteSpace(username);

                if(!isUsernameValid)
                {
                    await session.SendAsync("Invalid username.");
                }
            }
            
            return new LoginResult(true, true, username);
        }
开发者ID:FacticiusVir,项目名称:ScavengerMUD,代码行数:26,代码来源:LoginManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISessionFactory类代码示例发布时间:2022-05-24
下一篇:
C# IServices类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap