Beispiel #1
0
        /// <summary>
        /// Loads the property definition data
        /// </summary>
        private void LoadPropDefs(ICollection <string> xmlDefs)
        {
            try
            {
                if (xmlDefs.Count == 0 && _superClassDef == null)
                {
                    throw new InvalidXmlDefinitionException(String.Format("No property " +
                                                                          "definitions have been specified for the class definition of '{0}'. " +
                                                                          "Each class requires at least one 'property' and 'primaryKey' " +
                                                                          "element which define the mapping from the database table fields to " +
                                                                          "properties in the class that is being mapped to.",
                                                                          _className));
                }

                foreach (string propDefXml in xmlDefs)
                {
                    XmlPropertyLoader propLoader = new XmlPropertyLoader(DtdLoader, _defClassFactory);
                    IPropDef          propDef    = propLoader.LoadProperty(propDefXml);
                    if (propDef != null)
                    {
                        _propDefCol.Add(propDef);
                    }
                }
            }
            catch (Exception ex)
            {
                //This is a RecordingExceptionNotifier so this error will be logged and thrown later
                // thus allowing the entire XML File to be read and all errors reported
                GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
            }
        }
Beispiel #2
0
 /// <summary>
 /// Loads the property definition data
 /// </summary>
 private void LoadPropDefs(ICollection<string> xmlDefs)
 {
     try
     {
         if (xmlDefs.Count == 0 && _superClassDef == null)
         {
             throw new InvalidXmlDefinitionException(String.Format("No property " +
                                                                   "definitions have been specified for the class definition of '{0}'. " +
                                                                   "Each class requires at least one 'property' and 'primaryKey' " +
                                                                   "element which define the mapping from the database table fields to " +
                                                                   "properties in the class that is being mapped to.",
                                                                   _className));
         }
         
         foreach (string propDefXml in xmlDefs)
         {
             XmlPropertyLoader propLoader = new XmlPropertyLoader(DtdLoader, _defClassFactory);
             IPropDef propDef = propLoader.LoadProperty(propDefXml);
             if(propDef != null) _propDefCol.Add(propDef);
         }
     }
     catch (Exception ex)
     {
         //This is a RecordingExceptionNotifier so this error will be logged and thrown later
         // thus allowing the entire XML File to be read and all errors reported
         GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
     }
 }
 protected void Initialise() {
     _loader = new XmlPropertyLoader(new DtdLoader(), GetDefClassFactory());
 }