コード例 #1
0
		public FooComponent(String name, int count, DateTime[] dates, FooComponent subcomponent)
		{
			_name = name;
			_count = count;
			_importantDates = dates;
			_subcomponent = subcomponent;
		}
コード例 #2
0
 public FooComponent(String name, int count, DateTime[] dates, FooComponent subcomponent)
 {
     _name           = name;
     _count          = count;
     _importantDates = dates;
     _subcomponent   = subcomponent;
 }
コード例 #3
0
ファイル: Foo.cs プロジェクト: zhouweiaccp/nhibernate-core
        public LifecycleVeto OnSave(ISession s)
        {
            _string    = "a string";
            _date      = new DateTime(1970, 01, 01);
            _timestamp = DateTime.Now;
            _integer   = -666;
            _long      = 696969696969696969L - count++;
            _short     = 42;
            _float     = 6666.66f;
            //_double = new Double( 1.33e-69 );  // this double is too big for the sap db jdbc driver
//			_double = 1.12e-36;
            _boolean = true;
            _byte    = 127;
            _int     = 2;
            _char    = '@';
            _bytes   = Encoding.ASCII.GetBytes(_string);
            _status  = FooStatus.ON;
            custom   = new string[]
            {
                "foo", "bar"
            };
            //_component = new FooComponent("foo", 12, new DateTime[] { _date, _timestamp, DateTime.MinValue, new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ) }, new FooComponent("bar", 666, new DateTime[] { new DateTime(1999,12,3), DateTime.MinValue }, null ) );
            _component =
                new FooComponent("foo", 12,
                                 new DateTime[]
                                 { _date, _timestamp, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day) },
                                 new FooComponent("bar", 666, new DateTime[] { new DateTime(1999, 12, 3) }, null));
            _component.Glarch = new Glarch();
            _dependent        = new Fee();
            _dependent.Fi     = "belongs to foo # " + Key;
            _locale           = Thread.CurrentThread.CurrentCulture;
            return(LifecycleVeto.NoVeto);
        }
コード例 #4
0
ファイル: Baz.cs プロジェクト: uQr/nhibernate-core-testcase
        public void SetDefaults()
        {
            DateTime today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            StringSet = new HashedSet();
            StringSet.Add("foo");
            StringSet.Add("bar");
            StringSet.Add("baz");

            StringDateMap = new SortedList();
            StringDateMap.Add("now", DateTime.Now);
            StringDateMap.Add("never", null); // value is persisted since NH-2199
            // according to SQL Server the big bag happened in 1753 ;)
            StringDateMap.Add("big bang", new DateTime(1753, 01, 01));
            //StringDateMap.Add( "millenium", new DateTime( 2000, 01, 01 ) );
            ArrayList list = new ArrayList();
            list.AddRange(StringSet);
            StringList = list;
            IntArray = new int[] {1, 3, 3, 7};
            FooArray = new Foo[0];
            StringArray = (String[]) list.ToArray(typeof(string));
            Customs = new ArrayList();
            Customs.Add(new String[] {"foo", "bar"});
            Customs.Add(new String[] {"A", "B"});
            Customs.Add(new String[] {"1", "2"});

            FooSet = new HashedSet();
            Components = new FooComponent[]
                {
                    new FooComponent("foo", 42, null, null),
                    new FooComponent("bar", 88, null, new FooComponent("sub", 69, null, null))
                };
            TimeArray = new DateTime[]
                {
                    new DateTime(),
                    new DateTime(),
                    new DateTime(), // H2.1 has null here, but it's illegal on .NET
                    new DateTime(0)
                };

            Count = 667;
            Name = "Bazza";
            TopComponents = new ArrayList();
            TopComponents.Add(new FooComponent("foo", 11, new DateTime[] {today, new DateTime(2123, 1, 1)}, null));
            TopComponents.Add(
                new FooComponent("bar", 22, new DateTime[] {new DateTime(2007, 2, 3), new DateTime(1945, 6, 1)}, null));
            TopComponents.Add(null);
            Bag = new ArrayList();
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("unique");

            Cached = new ListSet();

            CompositeElement ce = new CompositeElement();
            ce.Foo = "foo";
            ce.Bar = "bar";
            CompositeElement ce2 = new CompositeElement();
            ce2.Foo = "fooxxx";
            ce2.Bar = "barxxx";
            Cached.Add(ce);
            Cached.Add(ce2);
            CachedMap = new SortedList();
            CachedMap.Add(this, ce);
        }
コード例 #5
0
        public void SetDefaults()
        {
            DateTime today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            StringSet = new HashedSet();
            StringSet.Add("foo");
            StringSet.Add("bar");
            StringSet.Add("baz");

            StringDateMap = new SortedList();
            StringDateMap.Add("now", DateTime.Now);
            StringDateMap.Add("never", null);             // value is persisted since NH-2199
            // according to SQL Server the big bag happened in 1753 ;)
            StringDateMap.Add("big bang", new DateTime(1753, 01, 01));
            //StringDateMap.Add( "millenium", new DateTime( 2000, 01, 01 ) );
            ArrayList list = new ArrayList();

            list.AddRange(StringSet);
            StringList  = list;
            IntArray    = new int[] { 1, 3, 3, 7 };
            FooArray    = new Foo[0];
            StringArray = (String[])list.ToArray(typeof(string));
            Customs     = new ArrayList();
            Customs.Add(new String[] { "foo", "bar" });
            Customs.Add(new String[] { "A", "B" });
            Customs.Add(new String[] { "1", "2" });

            FooSet     = new HashedSet();
            Components = new FooComponent[]
            {
                new FooComponent("foo", 42, null, null),
                new FooComponent("bar", 88, null, new FooComponent("sub", 69, null, null))
            };
            TimeArray = new DateTime[]
            {
                new DateTime(),
                new DateTime(),
                new DateTime(),                         // H2.1 has null here, but it's illegal on .NET
                new DateTime(0)
            };

            Count         = 667;
            Name          = "Bazza";
            TopComponents = new ArrayList();
            TopComponents.Add(new FooComponent("foo", 11, new DateTime[] { today, new DateTime(2123, 1, 1) }, null));
            TopComponents.Add(
                new FooComponent("bar", 22, new DateTime[] { new DateTime(2007, 2, 3), new DateTime(1945, 6, 1) }, null));
            TopComponents.Add(null);
            Bag = new ArrayList();
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("unique");

            Cached = new ListSet();

            CompositeElement ce = new CompositeElement();

            ce.Foo = "foo";
            ce.Bar = "bar";
            CompositeElement ce2 = new CompositeElement();

            ce2.Foo = "fooxxx";
            ce2.Bar = "barxxx";
            Cached.Add(ce);
            Cached.Add(ce2);
            CachedMap = new SortedList();
            CachedMap.Add(this, ce);
        }
コード例 #6
0
ファイル: FooBarTest.cs プロジェクト: remcoros/nhibernate
		public void ForceOuterJoin()
		{
			if (sessions.Settings.IsOuterJoinFetchEnabled == false)
			{
				// don't bother to run the test if we can't test it
				return;
			}

			ISession s = OpenSession();
			Glarch g = new Glarch();
			FooComponent fc = new FooComponent();
			fc.Glarch = g;
			FooProxy f = new Foo();
			FooProxy f2 = new Foo();
			f.Component = fc;
			f.TheFoo = f2;
			s.Save(f2);
			object id = s.Save(f);
			object gid = s.GetIdentifier(f.Component.Glarch);
			s.Flush();
			s.Close();

			s = OpenSession();
			f = (FooProxy) s.Load(typeof(Foo), id);
			Assert.IsFalse(NHibernateUtil.IsInitialized(f));
			Assert.IsTrue(NHibernateUtil.IsInitialized(f.Component.Glarch)); //outer-join="true"
			Assert.IsFalse(NHibernateUtil.IsInitialized(f.TheFoo)); //outer-join="auto"
			Assert.AreEqual(gid, s.GetIdentifier(f.Component.Glarch));
			s.Delete(f);
			s.Delete(f.TheFoo);
			s.Delete(f.Component.Glarch);
			s.Flush();
			s.Close();
		}
コード例 #7
0
		public LifecycleVeto OnSave(ISession s)
		{
			_string = "a string";
			_date = new DateTime( 1970, 01, 01 );
			_timestamp = DateTime.Now;
			_integer = -666;
			_long = 696969696969696969L - count++;
			_short = 42;
			_float = 6666.66f;
			//_double = new Double( 1.33e-69 );  // this double is too big for the sap db jdbc driver
//			_double = 1.12e-36;
			_boolean = true;
			_byte = 127;
			_int = 2;
			_char = '@';
			_bytes = System.Text.Encoding.ASCII.GetBytes(_string);
			_status=FooStatus.ON;
			custom = new string[]
			  {
				  "foo", "bar" 
			  };
			//_component = new FooComponent("foo", 12, new DateTime[] { _date, _timestamp, DateTime.MinValue, new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ) }, new FooComponent("bar", 666, new DateTime[] { new DateTime(1999,12,3), DateTime.MinValue }, null ) );
			_component = new FooComponent("foo", 12, new DateTime[] { _date, _timestamp, new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ) }, new FooComponent("bar", 666, new DateTime[] { new DateTime(1999,12,3) }, null ) );
			_component.Glarch = new Glarch();
			_dependent = new Fee();
			_dependent.Fi = "belongs to foo # " + Key;
			_locale = System.Threading.Thread.CurrentThread.CurrentCulture;
			return LifecycleVeto.NoVeto;
		}
コード例 #8
0
        public override bool Equals(object obj)
        {
            FooComponent fc = (FooComponent)obj;

            return(Count == fc.Count);
        }