示例#1
0
            public void BeforeEachTest()
            {
                const string input = @"
					<many-to-one name=""State"" class=""Mvba.Enterprise.Business.State, Mvba.Enterprise.Business"">
						<column name=""`STATE`"" length=""2"" sql-type=""VARCHAR2"" not-null=""true""/>
					</many-to-one>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#2
0
            public void BeforeEachTest()
            {
                const string input = @"
					<many-to-one name=""CourtTypeCode"" class=""Mvba.Enterprise.Business.Code, Mvba.Enterprise.Business"">
						<column name=""COURT_TYPE_CODE_ID"" sql-type=""NUMBER"" not-null=""true"" index=""IX_COURT_COURTTYPECODEID""/>
					</many-to-one>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#3
0
            public void BeforeEachTest()
            {
                const string input = @"
					<id name=""StateCode"" type=""String"" unsaved-value=""null"">
						<column name=""STATE_CODE"" length=""2"" sql-type=""VARCHAR2"" not-null=""true"" unique=""true"" index=""PK_STATES""/>
						<generator class=""assigned"" />
					</id>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#4
0
            public void BeforeEachTest()
            {
                const string input = @"
					<bag name=""Clerks"" inverse=""true"" table=""CLERK"" lazy=""true"" order-by=""FIRST_NAME"">
						<key column =""COUNTY_ID""/>
						<one-to-many class=""Mvba.Enterprise.Business.Clerk, Mvba.Enterprise.Business""/>
					</bag>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#5
0
            public void BeforeEachTest()
            {
                const string input = @"
					<set name=""TaxRecords"" inverse=""true"" cascade=""none""  table=""TAX_CALC_FILTER"" lazy=""true""  outer-join=""false"">
						<key column=""TAX_CALC_RUN_ID""/>
						<many-to-many  column=""SPTD_ID"" class=""Mvba.Enterprise.Business.TaxRecord, Mvba.Enterprise.Business""/>
					</set>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#6
0
            public void BeforeEachTest()
            {
                const string input = @"

					<property name=""LastName"" type=""String"">
						<column name=""LAST_NAME"" length=""50"" sql-type=""VARCHAR2"" not-null=""true""/>
					</property>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#7
0
            public void Should_emit_Table_if_present_in_original_xml()
            {
                const string    input     = @"";
                MappedClassInfo classInfo = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    );

                string result   = MappingConverter.Convert("CountyMap", classInfo, "Test");
                var    expected = (MappingConverter.FluentNHibernateNames.Table + @"(""USERS"");").SplitOnFormattingWhitespace();

                ClassFileUtilities.GetConstructorContents(result, "CountyMap").ShouldBeEqualTo(expected);
            }
示例#8
0
            public void BeforeEachTest()
            {
                const string input = @"
					<id name=""CountyId"" type=""Int32"" unsaved-value=""0"">
						<column name=""COUNTY_ID"" sql-type=""NUMBER"" not-null=""true"" unique=""true"" index=""PK_COUNTY""/>
						<generator class=""sequence""> 
							<param name=""sequence"">S_COUNTY_ID</param> 
						</generator> 
					</id>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#9
0
            public void BeforeEachTest()
            {
                const string input = @"
					<component name=""Address"" class=""Mvba.Enterprise.Business.Address, Mvba.Enterprise.Business"" insert=""true"" update=""true"">
						<property name=""Street"" column=""STREET"" type=""string"" not-null=""false"" ></property>
						<property name=""City"" column=""CITY"" type=""string"" not-null=""false"" ></property>
						<property name=""State"" column=""STATE"" type=""string"" not-null=""false"" ></property>
						<property name=""ZipCode"" column=""ZIPCODE"" type=""string"" not-null=""false"" ></property>
						<property name=""ZipPlus"" column=""ZIPPLUS"" type=""string"" not-null=""false"" ></property>
					</component>"                    ;

                _info = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"" table=""USERS"">"                         + input + @"</class>
					</hibernate-mapping>"                    ).Properties[0];
            }
示例#10
0
            public void Should_emit_Column_name()
            {
                const string    input     = @"
					<property name=""LastName"" type=""String"">
						<column name=""LAST_NAME"" sql-type=""VARCHAR2"" not-null=""false""/>
					</property>"                    ;
                MappedClassInfo classInfo = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"">"                         + input + @"</class>
					</hibernate-mapping>"                    );

                string result   = MappingConverter.Convert("CountyMap", classInfo, "Test");
                var    expected = (@"
					"                     + Map.FluentNHibernateNames.Map + @"(x => x.LastName, ""LAST_NAME"");").SplitOnFormattingWhitespace();

                ClassFileUtilities.GetConstructorContents(result, "CountyMap").ShouldBeEqualTo(expected, result);
            }
示例#11
0
            public void Should_emit_UnsavedValue_if_present_in_original_xml()
            {
                const string    input     = @"
					<id name=""CountyId"" type=""Int32"" unsaved-value=""0"">
						<column sql-type=""NUMBER"" not-null=""true"" unique=""true"" index=""PK_COUNTY""/>
					</id>"                    ;
                MappedClassInfo classInfo = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"">"                         + input + @"</class>
					</hibernate-mapping>"                    );

                string result   = MappingConverter.Convert("CountyMap", classInfo, "Test");
                var    expected = (@"
					"                     + Id.FluentNHibernateNames.Id + @"(x => x.CountyId)
						."                         + UnsavedValue.FluentNHibernateNames.UnsavedValue + @"(0);").SplitOnFormattingWhitespace();

                ClassFileUtilities.GetConstructorContents(result, "CountyMap").ShouldBeEqualTo(expected);
            }
示例#12
0
            public void Should_emit_Index_if_present_in_original_xml()
            {
                const string    input     = @"
					<many-to-one name=""State"" class=""Mvba.Enterprise.Business.State, Mvba.Enterprise.Business"">
						<column length=""2"" sql-type=""VARCHAR2"" index=""IX_STATE""/>
					</many-to-one>"                    ;
                MappedClassInfo classInfo = HbmFileUtility.LoadFromString(@"
					<hibernate-mapping xmlns=""urn:nhibernate-mapping-2.2"">
						<class name=""Mvba.Enterprise.Business.User, Mvba.Enterprise.Business"">"                         + input + @"</class>
					</hibernate-mapping>"                    );

                string result   = MappingConverter.Convert("CountyMap", classInfo, "Test");
                var    expected = (@"
					"                     + References.FluentNHibernateNames.References + @"(x => x.State)
						."                         + Index.FluentNHibernateNames.Index + @"(""IX_STATE"");").SplitOnFormattingWhitespace();

                ClassFileUtilities.GetConstructorContents(result, "CountyMap").ShouldBeEqualTo(expected);
            }