Specifying multiple SchemaImporters in machine.config

Posts   
 
    
Jean-Paul
User
Posts: 19
Joined: 22-Sep-2006
# Posted on: 22-Sep-2006 08:41:32   

Hi all,

I'm using LLBLGen Pro 2 Final along with adapter classes to persist information by making use of webservices. I generated the SchemaImporter assembly off the project and made the entry in machine.config as per the helpfiles. All works perfectly.

Now I want to add a second schema importer related to a completely seperate project. Thus one would attemt to modify the maching.config to look along the following lines

<system.xml.serialization>
  <schemaImporterExtensions>
    <add name="SchemaImporter" type="Project1.SchemaImporter, Project1Assembly,  Version=1.0.0.0, Culture=neutral, PublicKeyToken=ab123456c78de9f0" />
 <add name="SchemaImporter" type="Project2.SchemaImporter, Project2Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ab123456c78de9f0" />
  </schemaImporterExtensions>
</system.xml.serialization>

However one will need to specify a different value the name tag so the framework will know which schema importer to work with.

How do I specify another name for the name tag so LLBL will know which SchemaImporter assemly to reference from the GAC?

Thank you!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 22-Sep-2006 11:59:10   

Isn't that the name of the assembly ? Thus the name you can specify in the vs.net project of the schemaimporter?

Frans Bouma | Lead developer LLBLGen Pro
Jean-Paul
User
Posts: 19
Joined: 22-Sep-2006
# Posted on: 22-Sep-2006 15:41:01   

Hi Otis,

I just used those names as examples. Here follows the machine.config entry for the fist project:


    <system.xml.serialization>
        <schemaImporterExtensions>
            <add name="SchemaImporter" type="Palas.Data.SchemaImporter.EntityClassesSchemaImporter, SchemaImporter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4890cc32539b6fe6"/>
        </schemaImporterExtensions>
    </system.xml.serialization>

The machine.config markup for the second project follows:


<system.xml.serialization>
    <schemaImporterExtensions>
        <add name="SchemaImporter" type="Lems.Data.SchemaImporter.EntityClassesSchemaImporter,LemsSchemaImproter,Version=1.0.0.0,Culture=neutral,PublicKeyToken=170cf46d00ee38c9" />
    </schemaImporterExtensions>
</system.xml.serialization>

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 22-Sep-2006 17:31:17   

Yes but if you use a DIFFERENT assemblyname, for the schemaimporter project, you can specify that as the name. At least that's my understanding.

Frans Bouma | Lead developer LLBLGen Pro
Jean-Paul
User
Posts: 19
Joined: 22-Sep-2006
# Posted on: 23-Sep-2006 16:05:50   

I've tried this:


<system.xml.serialization>
  <schemaImporterExtensions>
    <add name="SchemaImporter" type="Palas.Data.SchemaImporter.EntityClassesSchemaImporter, PalasSchemaImporter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4890cc32539b6fe6" />
    <add name="SchemaImporter" type="Lems.Data.SchemaImporter.EntityClassesSchemaImporter, LemsSchemaImporter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=170cf46d00ee38c9" />
  </schemaImporterExtensions>
</system.xml.serialization>

and this:


<system.xml.serialization>
  <schemaImporterExtensions>
    <add name="PalasSchemaImporter" type="Palas.Data.SchemaImporter.EntityClassesSchemaImporter, PalasSchemaImporter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4890cc32539b6fe6" />
    <add name="LemsSchemaImporter" type="Lems.Data.SchemaImporter.EntityClassesSchemaImporter, LemsSchemaImporter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=170cf46d00ee38c9" />
  </schemaImporterExtensions>
</system.xml.serialization>

but still no luck. Any ideas? Both projects in VS2005 are called SchemaImporter. Should I rename them to the same names as the assemblies?

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 24-Sep-2006 18:41:11   

Every example I've found of using the SchemaImporterExtension class shows only one extension being used. If it DOES work for you with just one extension added, you could hack around the issue by generating a proxy for one, then switching your machine.config and generating a proxy for the other.

Here's a couple of the aforementioned examples:

http://msdn2.microsoft.com/en-us/library/ms229753.aspx http://www.bristowe.com/blog/2005/05/23/Ode+To+The+SystemXmlSerializationAdvancedSchemaImporterExtension+Class.aspx

Jean-Paul
User
Posts: 19
Joined: 22-Sep-2006
# Posted on: 27-Sep-2006 10:53:05   

Hi Chester,

Thanks for the information. In the end I included both lines in machine.config and just commented out the irrelevant one. The only hassle is having to restart each time for the changes to take effect.