Views: 5.9K
Replies: 1
Archived
|
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 1Parity 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.Domain. Art.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: ArtContext.Artists.Update(artist); InvContext.Sales.Update(sale); 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 . Jack Poorte, Sep 17, 2013
|