Back to list
Views:   5.9K
Replies:  1

Does the Spark platform support connecting to multiple databases?

In the Spark platform how can I connect to multiple database to perform CRUD operations?
Parity Bit, Sep 17, 2013
Reply 1
Parity Bit: 

Yes, Spark makes it incredibly easy to connect to multiple databases.

It is explained in the documentation, but let's look at the Art Shop solution as an example. It has two projects: Art.Web and Art.DomainArt.Web is the MVC application and Art.Domain contains the domain objects and data access code to the Art database. 

Suppose you need to access an another database called Inventory which maintains the availability of products. 
In Spark you would simply create a new project, say, Inv.Domain which contains the domain objects and data access code to the Inventory database. 

In your code you would access these databases like so: 


Here artist is a domain object related to the Art database and sale is a domain object related to the Inventory database.  

You could even wrap these UPDATE statements inside a distributed transaction using the UnitOfWorkDistributed object which is part of the Spark platform (this is the Unit of Work design pattern).

As you can see Spark makes it very easy to access multiple databases. 

I hope this helps. 

Jack Poorte, Sep 17, 2013
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.