Now that we have installed XPO is time to talk a little bit about processor architecture. If you are using a 64 bits processor you can compile your .net application with the following architectures
- Any CPU
- x64
- x86
XPO depends on ADO.NET DataAdapters in order to connect to the different databases and ADO.NET depends on DbProviderFactory to load the correct DataAdapter
Now that we know about all the processor’s architectures and DataAdapters we can understand which adapter will be loaded by processor architecture, see the following table:
Processor architecture | X86 OS | X64 OS |
Any CPU | Will load the 32 bits Data Adapters | Will load the 64 bits data adapter |
X64 | Won’t run on 32 bits OS | Will load the 64 bits data adapter |
X86 | Will load the 32 bits Data Adapters | Will load the 32 bits Data Adapters |
This does not seem important now, but I come from a time when 64 bits what’s not common at all so sometimes when you were developing your application you end up working on 64-bits OS running a 32-bits database and connecting to the database using the 32-bits DataAdapters.
So, you were not able to compile your application using “Any CPU” because that will try to instantiate a DataAdapters on its 64 bits version.
Nowadays most of the DataAdapters are either Any CPU or the adapter has been compiled to each supported architecture.
There is a well know scenario where you try to connect to an MS Access Database using the OleDb.Net provider and you won’t be able to connect on 64 bits OS since XPO will ask the DbProviderFactory to instantiate an OleDb Data Adapter for 64 bits architecture and that actually does not exist.
In conclusion, knowing how ADO.NET uses the DbProviderFactory will help you to understand which DataAdapter will XPO try to load in your application.