Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: NHibernate
if i build project using Nhibernate .net then after completing project can i switch one database server to another database server only by changing single configuration file ?
 
if it is possible then how can i do by Nghibernae .NET.
 
i am developing project but i want to use same project in multiple database server.. is possible in java hibernate but i want to use .NET platform. so is it possible in Nhibernate .NET. ?
Posted 28-Dec-12 0:27am
Edited 28-Dec-12 2:30am
v2
Comments
Oleksandr Kulchytskyi at 28-Dec-12 5:33am
   
So what do you meand in term of "multiple database server"?
Is it the same server architecture , but in differ location???
Or you mean various DB servers??

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

thus, based on the latest updates from U.
My approach lies in next.
You might to create generic repository interface and leverage it for basic CRUD operation , also you can leverage it with conjunction of UnityOfWork pattern(for example to commit all affected entities)....
 
After that you might implement specific entity repositories by inherits that generic repo interface and adjust each type of repo for concrete Database architecture.
so, for example in a result you will have
DepartmentRepoSqlServer,DepartmentRepoOracle... and so on.
  Permalink  
Comments
Oleksandr Kulchytskyi at 28-Dec-12 6:28am
   
Ohhh , sorry for my inattentiveness. Now i have caught what you mean..
Yep of course this things are still relevant for NHibernate.
Oleksandr Kulchytskyi at 28-Dec-12 7:56am
   
Sorry for so late response....
But if be honest, in my turn, i do not understand U..
What did you expect? If you are expected that i will write a whole explanation turtorial about implementing the same func like Java Hibernate but in consideration of NHibernate...
Do you know how much time it can takes?
I have shared to you from my Skydrive a link to a book, please read it!!!
https://skydrive.live.com/redir?resid=BF850F36B9E30F29!4507&authkey=!AKPW5f3sM0xm0ig
Oleksandr Kulchytskyi at 28-Dec-12 9:47am
   
1) i write application using NHibernate with configuration MS Sql server.-
In which form this configuration is persisted? in case of FLUENT API, my answer is NO, otherwise (in case of xml config), - YES.
 
NHibernate is some aspect is a replication (porting code from JAVA platform to C#) + some complementary changes have been added (such as LINQ - which is not characteristic of JAVA)
Oleksandr Kulchytskyi at 28-Dec-12 9:50am
   
You are welcome.
Oleksandr Kulchytskyi at 28-Dec-12 6:24am
   
Furthermore, in you injected in your solution such things as DI, and IoC,
you can achive functionality of replacing of usage differ DB servers on runtime , for example using config files.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100