コード例 #1
0
        private HbmMapping GetMapping()
        {
            var domainMapper = new DefaultDomainMapper();
            // un-comment the follow line and comment the previous to run the demo with a different mapper
            //var domainMapper = new CoolDomainMapper();

            var entities = new List <Type>();

            entities.AddRange(ModuleMappingUtil.RunModuleMapping <NaturalnessModuleMapping>(domainMapper.DomainDefinition, domainMapper.Mapper));

            return(domainMapper.Mapper.CompileMappingFor(entities));
        }
コード例 #2
0
        public void ShowSingleXmlMappingWithDearDbaAppliers()
        {
            var domainMapper = new DearDbaDomainMapper();
            var entities     = new List <Type>();

            entities.AddRange(ModuleMappingUtil.RunModuleMapping <NaturalnessModuleMapping>(domainMapper.DomainDefinition, domainMapper.Mapper));

            var document = Serialize(domainMapper.Mapper.CompileMappingFor(entities));

            File.WriteAllText("MyMapping.hbm.xml", document);
            Console.Write(document);
        }
コード例 #3
0
        public void WriteAllXmlMapping()
        {
            var domainMapper = new DefaultDomainMapper();
            var entities     = new List <Type>();

            entities.AddRange(ModuleMappingUtil.RunModuleMapping <NaturalnessModuleMapping>(domainMapper.DomainDefinition, domainMapper.Mapper));

            var mappings = domainMapper.Mapper.CompileMappingForEach(entities);

            foreach (var hbmMapping in mappings)
            {
                var fileName = GetFileName(hbmMapping);
                var document = Serialize(hbmMapping);
                File.WriteAllText(fileName, document);
            }
        }