public MappingsQueueEntry(NamedXmlDocument document, IEnumerable<ClassExtractor.ClassEntry> classEntries)
		{
			this.document = document;

			containedClassNames = GetClassNames(classEntries);
			requiredClassNames = GetRequiredClassNames(classEntries, containedClassNames);
		}
Example #2
0
 /// <summary>
 /// Adds the specified document to the queue.
 /// </summary>
 public void AddDocument(NamedXmlDocument document)
 {
     MappingsQueueEntry re = new MappingsQueueEntry(
         document,
         ClassExtractor.GetClassEntries(document.Document));
     AddEntry(re);
 }
Example #3
0
        public MappingsQueueEntry(NamedXmlDocument document, IEnumerable <ClassExtractor.ClassEntry> classEntries)
        {
            this.document = document;

            containedClassNames = GetClassNames(classEntries);
            requiredClassNames  = GetRequiredClassNames(classEntries, containedClassNames);
        }
Example #4
0
        public MappingsQueueEntry(NamedXmlDocument document, ICollection classEntries)
        {
            this.document = document;

            containedClassNames = GetClassNames(classEntries);
            requiredClassNames = GetExtendsNames(classEntries);
            requiredClassNames.RemoveAll(containedClassNames);
        }
Example #5
0
        /// <summary>
        /// Adds the specified document to the queue.
        /// </summary>
        public void AddDocument(NamedXmlDocument document)
        {
            MappingsQueueEntry re = new MappingsQueueEntry(document, ClassExtractor.GetClassEntries(document.Document));

            AddEntry(re);
        }
Example #6
0
		/// <summary>
		/// Takes the validated XmlDocument and has the Binder do its work of
		/// creating Mapping objects from the Mapping Xml.
		/// </summary>
		/// <param name="doc">The NamedXmlDocument that contains the <b>validated</b> mapping XML file.</param>
		private void AddValidatedDocument(NamedXmlDocument doc)
		{
			try
			{
				// note that the prefix has absolutely nothing to do with what the user
				// selects as their prefix in the document.  It is the prefix we use to 
				// build the XPath and the nsmgr takes care of translating our prefix into
				// the user defined prefix...
				XmlNamespaceManager namespaceManager = new XmlNamespaceManager(doc.Document.NameTable);
				namespaceManager.AddNamespace(HbmConstants.nsPrefix, MappingSchemaXMLNS);

				Dialect.Dialect dialect = Dialect.Dialect.GetDialect(properties);
				Mappings mappings = CreateMappings();

				new MappingRootBinder(mappings, namespaceManager, dialect).Bind(doc.Document.DocumentElement);
			}
			catch (Exception e)
			{
				string nameFormatted = doc.Name ?? "(unknown)";
				LogAndThrow(new MappingException("Could not compile the mapping document: " + nameFormatted, e));
			}
		}
Example #7
0
		private void AddDocumentThroughQueue(NamedXmlDocument document)
		{
			mappingsQueue.AddDocument(document);
			ProcessMappingsQueue();
		}
		/// <summary>
		/// Takes the validated XmlDocument and has the Binder do its work of
		/// creating Mapping objects from the Mapping Xml.
		/// </summary>
		/// <param name="doc">The NamedXmlDocument that contains the <b>validated</b> mapping XML file.</param>
		private void AddValidatedDocument(NamedXmlDocument doc)
		{
			try
			{
				HbmBinder.dialect = Dialect.Dialect.GetDialect(properties);
				HbmBinder.BindRoot(doc.Document, CreateMappings());
			}
			catch (Exception e)
			{
				string nameFormatted = doc.Name == null ? "(unknown)" : doc.Name;
				LogAndThrow(new MappingException("Could not compile the mapping document: " + nameFormatted, e));
			}
		}