Re: How to get domain from context

From: akira (wilsonaiked..mail.com)
Date: Wed Sep 02 2009 - 06:18:56 EDT

  • Next message: gilbertoca: "[modeler] Generate Database Schema doesn't generate every relationship"

    Hi Andrus, thanks for replying, i didn't thinked about casting it to
    DataContext! Thanks.

    On Sep 2, 2009, at 4:54 PM, Andrus Adamchik wrote:

    > Hi akira,
    >
    > If you need explicit access to the domain, you will have to cast you
    > ObjectContext to DataContext and use 'getParentDataDomain':
    >
    > DataDomain domain = ((DataContext) context).getParentDataDomain();
    >
    > Andrus
    >
    > On Sep 2, 2009, at 10:45 AM, akira wrote:
    >
    >> Hi, i'm getting my context this way: ObjectContext context =
    >> DataContext.getThreadObjectContext(). How to know the domain that
    >> the context is using? If i get context as a DataContext type i can
    >> obtain the domain using : getParentDataDomain().getName() right? On
    >> my app i have to change the domain under certain circumstancies and
    >> on my code i'm trying to do something like this:
    >> ObjectContext context = DataContext.getThreadObjectContext()
    >> if (context.getDomain() == domainToQueryNow) {
    >> return context;
    >> } else {
    >> DataContext.createDataContext(domainToQueryNow);
    >> }
    >>
    >> TIA.
    >



    This archive was generated by hypermail 2.0.0 : Wed Sep 02 2009 - 06:19:45 EDT