How to set initSql of BackendConfiguration in code?

Thread is closed for posting
2 posts, 0 answers
  1. Richard Koslik
    Richard Koslik avatar
    71 posts
    Member since:
    Apr 2010

    Posted 12 Oct 2010 Link to this post


    how can i set the initial sql command after the db connection in the code.

    I want to do it somewhere here...
    protected override MyDomainContext CreateDataContext()
        XmlMetadataSource metadataSource = XmlMetadataSource.FromAssemblyResource("MyTables.rlinq");
        string connectionString = string.Empty;
        BackendConfiguration dbConfig = new BackendConfiguration();
        dbConfig.initSql = ?????????????           
        return new MyDomainContext(connectionString, dbConfig, metadataSource);

    But i can't find the property to store the sql command.
    Where can it be done in code?

  2. Zoran
    Zoran avatar
    534 posts

    Posted 15 Oct 2010 Link to this post

    Hi Richard Koslik,

     The API in the BackendConfiguration settings are is split in few categories for more clear usage like: Runtime, Logging, ConnectionPool etc.
    The InitSQL setting is under the ConnectionPool settings so the code you should be using is the following:

    dbConfig.ConnectionPool.InitSQL.Add("Sample Statement");

    This way you are able to specify more than one initSQL statement for your connections.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top