コード例 #1
0
        public void DistinctTypes()
        {
            Repository repos = new Repository();

            ReferenceEstrato loc = new ReferenceEstrato(repos);
            ReferenceEstrato sul = new ReferenceEstrato(loc);
            ReferenceEstrato norte = new ReferenceEstrato(loc);
            ReferenceEstrato sudeste = new ReferenceEstrato(loc);
            ReferenceEstrato nordeste = new ReferenceEstrato(loc);

            using(new SessionScope())
            {
                repos.Save();
                loc.Save();
                sul.Save();
                sudeste.Save();
                norte.Save();
                nordeste.Save();
            }

            Survey pesquisa = new Survey();

            SurveyEstrato extCidade = new SurveyEstrato(pesquisa);
            // extCidade.ReferencedEstratos.Add(loc);

            SurveyEstrato extSub1 = new SurveyEstrato(extCidade, pesquisa);
            // extSub1.ReferencedEstratos.Add(sudeste);

            SurveyEstrato extSub2 = new SurveyEstrato(extCidade, pesquisa);
            // extSub2.ReferencedEstratos.Add(sudeste);

            SurveyEstrato extSub3 = new SurveyEstrato(extCidade, pesquisa);
            // extSub3.ReferencedEstratos.Add(sudeste);

            using(new SessionScope())
            {
                pesquisa.Save();
                extCidade.Save();
                extSub1.Save();
                extSub2.Save();
                extSub3.Save();
            }

            extCidade = SurveyEstrato.Find(extCidade.Id);
            Assert.IsNotNull(extCidade);

            Estrato[] estratos = SurveyEstrato.FindAll();
            Assert.AreEqual( 4, estratos.Length );

            estratos = ReferenceEstrato.FindAll();
            Assert.AreEqual( 5, estratos.Length );
        }
コード例 #2
0
        public SurveyEstrato(SurveyEstrato parentEstrato, Survey survey)
        {
            if (survey == null && parentEstrato == null)
            {
                throw new ArgumentNullException(
                          "You must specify either a survey or a parent estrato " +
                          "in order to create an estrato instance");
            }

            this.EstratoType = EstratoType.Survey;

            this.ParentEstrato = parentEstrato;

            if (survey == null)
            {
                this.Container = parentEstrato.Survey;
            }
            else
            {
                this.Container = survey;
            }
        }
コード例 #3
0
		public SurveyEstrato(SurveyEstrato parentEstrato, Survey survey)
		{
			if (survey == null && parentEstrato == null)
			{
				throw new ArgumentNullException(
					"You must specify either a survey or a parent estrato " + 
					"in order to create an estrato instance");
			}

			this.EstratoType = EstratoType.Survey;

			this.ParentEstrato = parentEstrato;

			if (survey == null)
			{
				this.Container = parentEstrato.Survey;
			}
			else
			{
				this.Container = survey;
			}			
		}
コード例 #4
0
 public SurveyEstrato(SurveyEstrato parentEstrato) : this(parentEstrato, null)
 {
 }
コード例 #5
0
		public SurveyEstrato(SurveyEstrato parentEstrato) : this(parentEstrato, null)
		{
		}