private XDocument generateDefaultRevisionInfoXmlMapping() { var document = new XDocument(); var classMapping = MetadataTools.CreateEntity(document, new AuditTableData(null, null, _globalCfg.DefaultSchemaName, _globalCfg.DefaultCatalogName), null, false); classMapping.Add(new XAttribute("name", revisionInfoEntityName), new XAttribute("table", "REVINFO")); MetadataTools.AddNativelyGeneratedId(classMapping, revisionInfoIdData.Name, revisionPropType); var timestampProperty = MetadataTools.AddProperty(classMapping, revisionInfoTimestampData.Name, revisionInfoTimestampType.Name, true, false, null); MetadataTools.AddColumn(timestampProperty, "REVTSTMP", -1, -1, -1, null, false); if (_globalCfg.IsTrackEntitiesChangedInRevisionEnabled) { generateEntityNamesTrackingTableMapping(classMapping, "ModifiedEntityNames", _globalCfg.DefaultSchemaName, _globalCfg.DefaultCatalogName, "REVCHANGES", "REV", "ENTITYNAME", "string"); } return(document); }
private XmlDocument generateDefaultRevisionInfoXmlMapping() { XmlDocument document = new XmlDocument();//ORIG: DocumentHelper.createDocument(); XmlElement class_mapping = MetadataTools.CreateEntity(document, new AuditTableData(null, null, null, null), null); class_mapping.SetAttribute("name", revisionInfoEntityName); class_mapping.SetAttribute("table", "REVINFO"); XmlElement idProperty = MetadataTools.AddNativelyGeneratedId(document, class_mapping, revisionInfoIdData.Name, revisionPropType); //ORIG: MetadataTools.addColumn(idProperty, "REV", -1, 0, 0, null); XmlElement col = idProperty.OwnerDocument.CreateElement("column"); col.SetAttribute("name", "REV"); //idProperty should have a "generator" node otherwise sth. is wrong. idProperty.InsertBefore(col, idProperty.GetElementsByTagName("generator")[0]); XmlElement timestampProperty = MetadataTools.AddProperty(class_mapping, revisionInfoTimestampData.Name, revisionInfoTimestampType.Name, true, false); MetadataTools.AddColumn(timestampProperty, "REVTSTMP", -1, 0, 0, SqlTypeFactory.DateTime.ToString()); return(document); }
private XElement generateRevisionInfoRelationMapping(string revisionAssQName) { var revRelMapping = new XElement(MetadataTools.CreateElementName("key-many-to-one"), new XAttribute("class", revisionAssQName)); if (revisionPropSqlType != null) { // Putting a fake name to make Hibernate happy. It will be replaced later anyway. MetadataTools.AddColumn(revRelMapping, "*", -1, -1, -1, revisionPropSqlType, false); } return(revRelMapping); }
private XmlElement generateRevisionInfoRelationMapping() { XmlDocument document = new XmlDocument(); XmlElement rev_rel_mapping = document.CreateElement("key-many-to-one"); rev_rel_mapping.SetAttribute("type", revisionPropType); rev_rel_mapping.SetAttribute("class", revisionInfoEntityName); if (revisionPropSqlType != null) { // Putting a fake name to make Hibernate happy. It will be replaced later anyway. MetadataTools.AddColumn(rev_rel_mapping, "*", -1, 0, 0, revisionPropSqlType); } return(rev_rel_mapping); }