Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# deivitgm 9/8/2007 7:59 PM
My idea is to start a new module that can get data from another database. For example, f.e. retribe producs from other an erp database.
I think that the steps are:

1) Create domain casses (product,productcategory...) and nhibernate mappings
2) Create a dao interface
3) modify gloval.asax.cs ??????

My doupts are:

How I can assign my connection to my project?
Is possible to use sessionManager.OpenSession('MyConnection') and add a new facility?
Is possible to add an specidic session to one section? f.e. if i want to reuse my module for get products from differents sources.


Thanks for your support

David












# martijnb 9/10/2007 12:22 PM (edited 9/10/2007 12:24 PM)
In your own modules, you can use any data access strategies that you want.

If you're going to leverage the existing infrastructure (with Castle and NHibernate), you can add an extra database section in facilities.config via (replace square brackets with angled ones):

[factory id="nhibernate.factory" alias="mydatabase"]

and access it via:
ISession session = sessionManager.OpenSession("mydatabase");
# deivitgm 9/10/2007 12:36 PM
Thanks Martijn

and the possibility of set a default session for one section??

# martijnb 9/10/2007 3:08 PM
Maybe you can add a section setting for the database alias?
# El Gringo 10/11/2007 4:29 PM
deivitgmMy idea is to start a new module that can get data from another database. For example, f.e. retribe producs from other an erp database.

If you want to mix up the classes in one session, you can also use the schema attribute in your mapping classes.
... hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="yourDatabase.dbo" ...
This way you can access your and the cuyahoga classes within the default session. Don't forget to add your assembly to the facilities.config.