<commit_before>using System;
using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Mapping.ByCode;
using NHibernate.Test.MappingByCode.NatureDemo.Naturalness;
using NUnit.Framework;

namespace NHibernate.Test.MappingByCode.NatureDemo
{
	public class ShowXmlDemo
	{
		[Test, Explicit]
		public void MappingAndShowXmlInConsole()
		{
			Console.Write(GetMapping().AsString());
		}

		public static HbmMapping GetMapping()
		{
			var mapper = new ModelMapper();

			mapper.Class<Animal>(rc=> 
			{
				rc.Id(x => x.Id, map => map.Generator(Generators.Native));

				rc.Property(animal => animal.Description);
				rc.Property(animal => animal.BodyWeight);
				rc.ManyToOne(animal => animal.Mother);
				rc.ManyToOne(animal => animal.Father);
				rc.ManyToOne(animal => animal.Zoo);
				rc.Property(animal => animal.SerialNumber);
				rc.Set(animal => animal.Offspring, cm => cm.OrderBy(an => an.Father), rel => rel.OneToMany());
			});

			mapper.JoinedSubclass<Reptile>(jsc => { jsc.Property(reptile => reptile.BodyTemperature); });

			mapper.JoinedSubclass<Lizard>(jsc => { });

			mapper.JoinedSubclass<Mammal>(jsc =>
			{
				jsc.Property(mammal => mammal.Pregnant);
				jsc.Property(mammal => mammal.Birthdate);
			});

			mapper.JoinedSubclass<DomesticAnimal>(jsc =>
			                                      {
			                                      	jsc.ManyToOne(domesticAnimal => domesticAnimal.Owner);
			                                      });

			mapper.JoinedSubclass<Cat>(jsc => { });

			mapper.JoinedSubclass<Dog>(jsc => { });

			mapper.JoinedSubclass<Human>(jsc =>
			{
				jsc.Component(human => human.Name, comp =>
				{
					comp.Property(name => name.First);
					comp.Property(name => name.Initial);
					comp.Property(name => name.Last);
				});
				jsc.Property(human => human.NickName);
				jsc.Property(human => human.Height);
				jsc.Property(human => human.IntValue);
				jsc.Property(human => human.FloatValue);
				jsc.Property(human => human.BigDecimalValue);
				jsc.Property(human => human.BigIntegerValue);
				jsc.Bag(human => human.Friends, cm => { }, rel => rel.ManyToMany());
				jsc.Map(human => human.Family, cm => { }, rel => rel.ManyToMany());
				jsc.Bag(human => human.Pets, cm => { cm.Inverse(true); }, rel => rel.OneToMany());
				jsc.Set(human => human.NickNames, cm =>
				{
					cm.Lazy(CollectionLazy.NoLazy);
					cm.Sort();
				}, cer => { });
				jsc.Map(human => human.Addresses, cm => { }, mk => { }, rel => rel.Component(comp =>
				{
					comp.Property(address => address.Street);<commit_msg>Minor<commit_after>using System;
using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Mapping.ByCode;
using NHibernate.Test.MappingByCode.NatureDemo.Naturalness;
using NUnit.Framework;

namespace NHibernate.Test.MappingByCode.NatureDemo
{
	public class ShowXmlDemo
	{
		[Test, Explicit]
		public void MappingAndShowXmlInConsole()
		{
			Console.Write(GetMapping().AsString());
		}

		public static HbmMapping GetMapping()
		{
			var mapper = new ModelMapper();

			mapper.Class<Animal>(rc=> 
			{
				rc.Id(x => x.Id, map => map.Generator(Generators.Native));

				rc.Property(animal => animal.Description);
				rc.Property(animal => animal.BodyWeight);
				rc.ManyToOne(animal => animal.Mother);
				rc.ManyToOne(animal => animal.Father);
				rc.ManyToOne(animal => animal.Zoo);
				rc.Property(animal => animal.SerialNumber);
				rc.Set(animal => animal.Offspring, cm => cm.OrderBy(an => an.Father), rel => rel.OneToMany());
			});

			mapper.JoinedSubclass<Reptile>(jsc => { jsc.Property(reptile => reptile.BodyTemperature); });

			mapper.JoinedSubclass<Lizard>(jsc => { });

			mapper.JoinedSubclass<Mammal>(jsc =>
			{
				jsc.Property(mammal => mammal.Pregnant);
				jsc.Property(mammal => mammal.Birthdate);
			});

			mapper.JoinedSubclass<DomesticAnimal>(jsc =>
			                                      {
			                                      	jsc.ManyToOne(domesticAnimal => domesticAnimal.Owner);
			                                      });

			mapper.JoinedSubclass<Cat>(jsc => { });

			mapper.JoinedSubclass<Dog>(jsc => { });

			mapper.JoinedSubclass<Human>(jsc =>
			{
				jsc.Component(human => human.Name, comp =>
				{
					comp.Property(name => name.First);
					comp.Property(name => name.Initial);
					comp.Property(name => name.Last);
				});
				jsc.Property(human => human.NickName);
				jsc.Property(human => human.Height);
				jsc.Property(human => human.IntValue);
				jsc.Property(human => human.FloatValue);
				jsc.Property(human => human.BigDecimalValue);
				jsc.Property(human => human.BigIntegerValue);
				jsc.Bag(human => human.Friends, cm => { }, rel => rel.ManyToMany());
				jsc.Map(human => human.Family, cm => { }, rel => rel.ManyToMany());
				jsc.Bag(human => human.Pets, cm => { cm.Inverse(true); }, rel => rel.OneToMany());
				jsc.Set(human => human.NickNames, cm =>
				{
					cm.Lazy(CollectionLazy.NoLazy);
					cm.Sort();
				}, cer => { });
				jsc.Map(human => human.Addresses, cm => { }, rel => rel.Component(comp =>
				{
					comp.Property(address => address.Street);
{'fraction_non_alphanumeric': 0.16285434995112413, 'fraction_numerical': 0.0, 'mean_word_length': 3.037884767166535, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 124, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1460631', 'n_tokens_mistral': 2058, 'n_tokens_neox': 1659, 'n_words': 240}