Change Connection String used, not stored in config file

3 posts, 0 answers
  1. Scott
    Scott avatar
    68 posts
    Member since:
    Nov 2011

    Posted 11 Jan 2012 Link to this post

    Our users have the ability to connect to different databases via our WinForm application, thus the connection strings are not stored in the config file. How do we override the connection that gets used by OpenAccess?
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 13 Jan 2012 Link to this post

    Hello Scott,

    You can use one of the constructors of the generated context class which has a connection parameter. The value can be either a connection name, pointing to a connection string in the configuration file, or the whole connection string. So all you need to do is get the connection string from the used and pass it to the constructor of the context.
    Hope that helps.

    Kind regards,
    Alexander
    the Telerik team

    SP1 for Q3’11 of Telerik OpenAccess ORM is available for download

  3. DevCraft banner
  4. Scott
    Scott avatar
    68 posts
    Member since:
    Nov 2011

    Posted 13 Jan 2012 Link to this post

    Yes, that worked perfectly. Thanks!
Back to Top