public void TestOnOpenSession()
        {
            CreateAliasEvent eve = new CreateAliasEvent(null, null);
            ICriteria crit = Mock<ICriteria>();

            using (Mocks.Record())
            {
                Expect.Call(crit.CreateAlias(null, null)).Return(crit);
            }
            using (Mocks.Playback())
            {
                eve.OnEvent(crit);
            }
        }
示例#2
0
        public ICriteria CreateAlias(string associationPath, string alias, JoinType joinType)
        {
            ICriteriaEvent criteriaEvent = new CreateAliasEvent(associationPath, alias, joinType);

            foreach (IShard shard in shards)
            {
                if (shard.GetCriteriaById(criteriaId) != null)
                {
                    shard.GetCriteriaById(criteriaId).CreateAlias(associationPath, alias, joinType);
                }
                else
                {
                    shard.AddCriteriaEvent(criteriaId, criteriaEvent);
                }
            }
            return(this);
        }
示例#3
0
        public ICriteria CreateAlias(string associationPath, string alias, JoinType joinType)
        {
            ICriteriaEvent criteriaEvent = new CreateAliasEvent(associationPath, alias, joinType);

            foreach (IShard shard in shards)
            {
                if (shardToCriteriaMap[shard] != null)
                {
                    shardToCriteriaMap[shard].CreateAlias(associationPath, alias, joinType);
                }
                else
                {
                    shardToEventListMap[shard].Add(criteriaEvent);
                }
            }
            return(this);
        }