Click here to Skip to main content
15,891,905 members
Home / Discussions / Database
   

Database

 
GeneralRe: DB Small Footprint (Access? Firebird?) Pin
Luis Alonso Ramos23-Mar-05 20:43
Luis Alonso Ramos23-Mar-05 20:43 
Questionsuggest me a good book ? Pin
WDI19-Mar-05 22:18
WDI19-Mar-05 22:18 
AnswerRe: suggest me a good book ? Pin
Andy *M*21-Mar-05 9:25
Andy *M*21-Mar-05 9:25 
GeneralGenericOLEDB Pin
sjurmr19-Mar-05 11:20
sjurmr19-Mar-05 11:20 
GeneralSQL database protection Pin
Wimal Prasanna19-Mar-05 4:39
Wimal Prasanna19-Mar-05 4:39 
GeneralRe: SQL database protection Pin
Colin Angus Mackay19-Mar-05 10:32
Colin Angus Mackay19-Mar-05 10:32 
GeneralRe: SQL database protection Pin
Mike Dimmick19-Mar-05 23:08
Mike Dimmick19-Mar-05 23:08 
GeneralOR mapping tools And Object Broker pattern Pin
devvvy19-Mar-05 2:51
devvvy19-Mar-05 2:51 
Hi, I have two design objectives in mind:
1. to integrate NHibernate into data access layer of our applications
2. to maintain flexibility to switch from one OR tool (Object Relational mapping tool) to another (HNibernate to ADO.NET 2.0 ObjectSpace for instance).

To meet these requirements, it's neccessary to top our "OR" layer with an additional "OR broker" layer

class ObjBrokerFactory {<br />
   <br />
   IObjBroker GetObjBroker(ortype) {<br />
      select ortype:<br />
        case NHIBERNATE: return (IObjBroker) new NHibnernateObjBroker(...);<br />
        case OBJSPACE: return (IObjBroker) new ObjSpaceBroker(...);<br />
   }<br />
}<br />
<br />
class ObjHNibernateBroker {<br />
   public New(...) {<br />
     ... initialized depending on OR type specified ...<br />
   }<br />
<br />
   public Finder(criteria) {...}<br />
   public Insert(obj) {...}<br />
   public Update(obj) {...}<br />
   public Delete(obj) {...}<br />
}<br />


Then in client, instead of calling :

UserAccount acc = new UserAccount(...);<br />
acc.Email = "john.doe@hotmail.com";<br />
...<br />
IObjBroker broker = brokerFactory.GetObjBroker(ortype.NHIBERNATE);<br />
...<br />
broker.Insert(acc);<br />
...


Looks nice and clean, but, what if you need to persists a number of different object within one transaction? With NHibernate:
<br />
ISessionFactory factory = cfg.BuildSessionFactory();<br />
ISession session = factory.OpenSession();<br />
ITransaction transaction = session.BeginTransaction();<br />
User newUser = new User();<br />
newUser.Id = "joe_cool";<br />
newUser.UserName = "Joseph Cool";<br />
...<br />
session.Save(newUser);<br />
...<br />
transaction.Commit();<br />
session.Close();<br />

With ObjectSpace however:
<br />
IObjectSpace animal = (Animal) objectSpace.CreateObject(typeof(Animal), <br />
          ID, Age, Weight);<br />
objectSpace.BeginTransaction();<br />
objectSpace.Update(animal);<br />
objectSpace.CommitTransaction();<br />

So much so for our "OR Broker" layer - any suggestion? Is there any good authoritative article on this subject? Design Pattern I'm not aware of?

Thanks in advance.


References:
1. NHibernate QuickStart http://nhibernate.sourceforge.net/quickstart.html
2. NHibernate - a more practical sample http://www.theserverside.net/articles/showarticle.tss?id=NHibernate[^]
3. ASP Appliance ADO.NET 2.0 ObjectSpace http://aspalliance.com/articleViewer.aspx?aId=248[^]
4. MSDN ObjectSpace http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/objectspaces.asp[^]
5. Sitepoint: http://www.sitepoint.com/blog-post-view.php?id=156266[^]

Norman Fung
GeneralSoundex In Ado.net Dataset Search Pin
Hemant Mane18-Mar-05 22:41
Hemant Mane18-Mar-05 22:41 
QuestionIIS Webhits via ADO.NET? Pin
harryteck18-Mar-05 13:39
harryteck18-Mar-05 13:39 
GeneralINNER JOIN Pin
HahnTech18-Mar-05 9:00
HahnTech18-Mar-05 9:00 
GeneralRe: INNER JOIN Pin
HahnTech18-Mar-05 10:22
HahnTech18-Mar-05 10:22 
QuestionCan someone give me an advise for my application's database Pin
Blue_Skye18-Mar-05 6:31
Blue_Skye18-Mar-05 6:31 
QuestionWhich is better on webservice? Pin
WDI18-Mar-05 0:27
WDI18-Mar-05 0:27 
AnswerRe: Which is better on webservice? Pin
Hesham Amin18-Mar-05 2:13
Hesham Amin18-Mar-05 2:13 
Generaland - or statement Pin
WDI18-Mar-05 0:20
WDI18-Mar-05 0:20 
GeneralRe: and - or statement Pin
Colin Angus Mackay18-Mar-05 1:58
Colin Angus Mackay18-Mar-05 1:58 
GeneralRe: and - or statement Pin
WDI25-Mar-05 6:46
WDI25-Mar-05 6:46 
GeneralRe: and - or statement Pin
Colin Angus Mackay25-Mar-05 11:18
Colin Angus Mackay25-Mar-05 11:18 
GeneralRe: and - or statement Pin
Michael Potter18-Mar-05 6:01
Michael Potter18-Mar-05 6:01 
GeneralRe: and - or statement Pin
Michael Potter18-Mar-05 6:13
Michael Potter18-Mar-05 6:13 
GeneralRe: and - or statement Pin
WDI18-Mar-05 9:31
WDI18-Mar-05 9:31 
GeneralRe: and - or statement Pin
Michael Potter18-Mar-05 10:04
Michael Potter18-Mar-05 10:04 
Questionhow to call for update in two different databases? Pin
mijan17-Mar-05 19:47
mijan17-Mar-05 19:47 
AnswerRe: how to call for update in two different databases? Pin
Anonymous20-Mar-05 21:54
Anonymous20-Mar-05 21:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.