Exemplo n.º 1
0
        /// <summary>
        /// Loads the primary key definition data
        /// </summary>
        private void LoadPrimaryKeyDef(string xmlDef)
        {
            try
            {
                if (xmlDef == null && _superClassDef == null)
                {
                    throw new InvalidXmlDefinitionException
                              (String.Format
                                  ("Could not find a " + "'primaryKey' element in the class definition for the class '{0}'. "
                                  + "Each class definition requires a primary key "
                                  + "definition, which is composed of one or more property definitions, "
                                  + "implying that you will need at least one 'prop' element as " + "well.", _className));
                }
                if (xmlDef == null)
                {
                    return;
                }

                XmlPrimaryKeyLoader primaryKeyLoader = new XmlPrimaryKeyLoader(DtdLoader, _defClassFactory);
                _primaryKeyDef = primaryKeyLoader.LoadPrimaryKey(xmlDef, _propDefCol);
                if (_primaryKeyDef == null)
                {
                    throw new InvalidXmlDefinitionException
                              (String.Format
                                  ("There was an error loading "
                                  + "the 'primaryKey' element in the class definition for the class '{0}. '"
                                  + "Each class definition requires a primary key "
                                  + "definition, which is composed of one or more property definitions, "
                                  + "implying that you will need at least one 'prop' element as " + "well.", _className));
                }
            }
            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 ");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the primary key definition data
        /// </summary>
        private void LoadPrimaryKeyDef(string xmlDef)
        {
            try
            {
                if (xmlDef == null && _superClassDef == null)
                {
                    throw new InvalidXmlDefinitionException
                        (String.Format
                             ("Could not find a " + "'primaryKey' element in the class definition for the class '{0}'. "
                              + "Each class definition requires a primary key "
                              + "definition, which is composed of one or more property definitions, "
                              + "implying that you will need at least one 'prop' element as " + "well.", _className));
                }
                if (xmlDef == null) return;

                XmlPrimaryKeyLoader primaryKeyLoader = new XmlPrimaryKeyLoader(DtdLoader, _defClassFactory);
                _primaryKeyDef = primaryKeyLoader.LoadPrimaryKey(xmlDef, _propDefCol);
                if (_primaryKeyDef == null)
                {
                    throw new InvalidXmlDefinitionException
                        (String.Format
                             ("There was an error loading "
                              + "the 'primaryKey' element in the class definition for the class '{0}. '"
                              + "Each class definition requires a primary key "
                              + "definition, which is composed of one or more property definitions, "
                              + "implying that you will need at least one 'prop' element as " + "well.", _className));
                }
            }
            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 ");
            }
        }