Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Architecture for database-aware Application

I'm looking for a reference implementation of the "Unit of work" and "repository" pattern for MS SQL Server or Plain old ADO.NET. But all samples are build aroud an existing context like Linq2SQL or EF. According to my understanding, these technologies are themselves almost implementing these pattern.

But how do I deal with a "plain" SQL Repository without any context and SaveChanges() methods? Is the right way to use TransactionScope? For example collect all SQL Operations in a List of commands and then simple execute them one after each other within a Tx Scope... or is this too simple?

Why am I looking for this? I have the task of building a data layer that can both deal with an ancient Sybase database as well as SQL Server (maybe additional in conjunction with a POCO based EF4 Component)

For this my Idea is to create an abstraction layer with a Repository and Unit of Work Pattern and create different implementations for each Technology.

Update: I was on vacation the last week. Sorry for the delay. Today I built up an basic picture of my architecture for this. [link] (s7.directupload.net/file/d/2570/whb7ulbs_jpg.htm). My idea is to create a simple ObjectContext like the EF ObjectContext that exists parallel to the EF Context and is used by my repository. This context collects ATOM Sql Transactions in a kind of Stack and executes them within the Transaction within the Unit of Work part. Good idea? Bad Idea? Hard to do? I'm looking forward to your views on this.

like image 482
Arthur Avatar asked Jun 21 '11 11:06

Arthur


People also ask

What is RAC architecture?

A RAC database is a set of files on shared storage and can span multiple nodes. A RAC database instance is a set of processes and memory that operates on the database files. A RAC database instance resides on one node.

How does RAC database work?

Oracle RAC allows multiple computers to run Oracle RDBMS software simultaneously while accessing a single database, thus providing clustering. In a non-RAC Oracle database, a single instance accesses a single database. The database consists of a collection of data files, control files, and redo logs located on disk.

What is RAC aware application?

From my undestanding, a "RAC aware" application is an application which will be deployed and using an Oracle RAC environment. For clustered environments, sometimes applications need to take some special considerations, that will vary between providers.

Does AWS support Oracle RAC?

You can run advanced architectures like Oracle Real Application Cluster (RAC) and Oracle RAC extended clusters (across different AZs) in VMware Cloud on AWS.


1 Answers

I don't envy your task; supporting multiple backend databases in your application is going to be tricky.

Here's an example of a Unit Of Work pattern using ASP.NET MVC and LightSpeed: link

Personally, I would use EF or NHibernate (prefer EF); SQL Anywhere supports ADO.NET and Entity Framework, so (ideally) you wouldn't need to do anything special to support that database.

Good luck!

like image 195
Brad Divine Avatar answered Oct 05 '22 11:10

Brad Divine