Hello Manu:
I had similar experience, what I needed were have the same entities but in
different databases (even in different Engines i.e Oracle, MsSQl, etc), so
we can support almost transparently several client implementations in
Database but with the same design.
I have to custom the code of Burrow in the following files:
BurrowFramework.cs:
/// <summary>
/// Numero método incluido para Framework
/// </summary>
/// <param name="configurationId"></param>
/// <returns></returns>
public ISessionFactory GetSessionFactoryByName(string
configurationId)
{
if (PersistenceUnitRepo.Instance == null)
PersistenceUnitRepo.Initialize(BurrowEnvironment.Configuration);
return
PersistenceUnitRepo.Instance.GetPUByName(configurationId).SessionFactory;
}
/// <summary>
/// Oscar Orduz.
/// </summary>
/// <param name="configurationId"></param>
/// <returns></returns>
public ISession GetSessionByName(string configurationId)
{
AbstractConversation c =
((AbstractConversation)CurrentConversation);
return c.GetSessionByName(configurationId);
}
AbstractConversation.cs
/// <summary>
/// Oscar Orduz
/// </summary>
/// <param name="configurationId"></param>
/// <returns></returns>
public ISession GetSessionByName(string configurationId)
{
SessionManager sm = string.IsNullOrEmpty(configurationId) ?
GetSessionManager() : GetSessionManagerByName(configurationId);
return GetSession(sm);
}
/// <summary>
/// Método creado para el manejo de la sesión para el framework de
PS
/// </summary>
/// <param name="configurationId"></param>
/// <returns></returns>
internal SessionManager GetSessionManagerByName(string
configurationId)
{
return
sessManagers[PersistenceUnitRepo.Instance.GetPUByName(configurationId)];
}
PersistenceUnitRepo.cs
/// <summary>
/// Método creado para la recuperación por nombre
/// </summary>
/// <param name="configurationId"></param>
/// <returns></returns>
public PersistenceUnit GetPUByName(string configurationId)
{
if (PersistenceUnits.Count == 1)
{
return PersistenceUnits[0];
}
foreach (PersistenceUnit pu in persistenceUnits)
{
if (pu.Name == configurationId)
{
return pu;
}
}
throw new GeneralException("Persistence Unit cannot be found for
" + configurationId);
}
I have mantained this code for three releases of burrow and until now it
works fine
Hope this help.
Oscar
2008/12/18 Manu <[email protected]>
>
> I have been looking at the Burrow source code and I'm not sure if I
> can use its GenericDAO to handle multiple databases the way I want.
>
> I have see that the Session property of the GenericDAO class calls
> BurrowFramework().GetSession(_NHEntityType) and that works good if the
> multiples databases you're working with have different entities.
> However, it can't handle multiple databases with the same mapped
> entities as the GetSession method always returns the first
> PersistenceUnit. So I think GenericDAO needs an overload to specify a
> session factory name to retrieve the proper PersistenceUnit by name
> instead of by type.
>
> As I have started today to look at Burrow I may be wrong, so if anyone
> is familiar with it I'd appreciate if he can show some light about
> that problem.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---