Click here to Skip to main content
15,900,907 members
Home / Discussions / Database
   

Database

 
GeneralRe: Package And Deployment Wizard Pin
rwestgraham22-Mar-05 10:58
rwestgraham22-Mar-05 10:58 
Generaldataset or datareader Pin
jinnyb21-Mar-05 20:41
jinnyb21-Mar-05 20:41 
GeneralRe: dataset or datareader Pin
Colin Angus Mackay21-Mar-05 21:03
Colin Angus Mackay21-Mar-05 21:03 
QuestionWhich is faster? Pin
Yulianto.21-Mar-05 15:16
Yulianto.21-Mar-05 15:16 
AnswerRe: Which is faster? Pin
Christian Graus21-Mar-05 15:32
protectorChristian Graus21-Mar-05 15:32 
GeneralViewing stored procedures Pin
Its due when21-Mar-05 2:58
Its due when21-Mar-05 2:58 
GeneralRe: Viewing stored procedures Pin
Colin Angus Mackay21-Mar-05 3:09
Colin Angus Mackay21-Mar-05 3:09 
GeneralRe: Viewing stored procedures Pin
Scott Serl21-Mar-05 10:22
Scott Serl21-Mar-05 10:22 
Generaldiff between managed providers and ole-db provider Pin
satishrg20-Mar-05 19:16
satishrg20-Mar-05 19:16 
GeneralRe: diff between managed providers and ole-db provider Pin
Colin Angus Mackay21-Mar-05 3:12
Colin Angus Mackay21-Mar-05 3:12 
Generalthank you very much Pin
satishrg21-Mar-05 10:48
satishrg21-Mar-05 10:48 
GeneralMSDE won't install Pin
Christian Graus20-Mar-05 17:36
protectorChristian Graus20-Mar-05 17:36 
GeneralDB Small Footprint (Access? Firebird?) Pin
Dato20-Mar-05 7:19
Dato20-Mar-05 7:19 
GeneralRe: DB Small Footprint (Access? Firebird?) Pin
salsafyren221-Mar-05 0:08
salsafyren221-Mar-05 0:08 
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 

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.