public static string CreateMappingXMLFrom( Entity entity, string assemblyName, string entityNamespace, bool autoImport, TopLevelAccessTypes defaultAccess, TopLevelCascadeTypes defaultCascade, bool defaultLazy) { hibernatemapping hm = new hibernatemapping { @namespace = entityNamespace, assembly = assemblyName, autoimport = autoImport }; if (defaultAccess != TopLevelAccessTypes.property) hm.defaultaccess = defaultAccess.ToString(); if (defaultCascade != TopLevelCascadeTypes.none) hm.defaultcascade = defaultCascade.ToString().Replace("_", "-"); if (!defaultLazy) hm.defaultlazy = defaultLazy; EntityMapper mapper = new EntityMapper(); var newClass = mapper.ProcessEntity(entity); hm.AddClass(newClass); return hm.ToXml().Replace(@"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" ", "").Replace(@"xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" ", ""); }
public static string UpdateNHibernateMappingFile(hibernatemapping hm, EntitySetImpl entitySet) { EntityMapper mapper = new EntityMapper(); foreach (var entity in entitySet.Entities) { var newClass = mapper.ProcessEntity(entity); hm.AddClass(newClass); } return(hm.ToXml()); }
public static string CreateMappingXMLFrom( Entity entity, string assemblyName, string entityNamespace, bool autoImport, TopLevelAccessTypes defaultAccess, TopLevelCascadeTypes defaultCascade, bool defaultLazy) { hibernatemapping hm = new hibernatemapping { @namespace = entityNamespace, assembly = assemblyName, autoimport = autoImport }; if (defaultAccess != TopLevelAccessTypes.property) { hm.defaultaccess = defaultAccess.ToString(); } if (defaultCascade != TopLevelCascadeTypes.none) { hm.defaultcascade = defaultCascade.ToString().Replace("_", "-"); } if (!defaultLazy) { hm.defaultlazy = defaultLazy; } EntityMapper mapper = new EntityMapper(); var newClass = mapper.ProcessEntity(entity); hm.AddClass(newClass); return(hm.ToXml().Replace(@"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" ", "").Replace(@"xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" ", "")); }
public static string UpdateNHibernateMappingFile(hibernatemapping hm, EntitySetImpl entitySet) { EntityMapper mapper = new EntityMapper(); foreach (var entity in entitySet.Entities) { var newClass = mapper.ProcessEntity(entity); hm.AddClass(newClass); } return hm.ToXml(); }