Adding Oracle to SQL Server based project

9 posts, 1 answers
  1. Marcelo
    Marcelo avatar
    13 posts
    Member since:
    Feb 2011

    Posted 11 May 2011 Link to this post

    I find some post here in forum, including http://www.telerik.com/community/forums/orm/databases/how-to-support-oracle-and-sqlserver-with-only-one-model.aspx, but I could not make it work.

    I have a project using SQL Server, with all classes mapped with Attributes, and already with friendly names, ie, I changed all classes and property names because names in database follows client rules.

    The Oracle database is already created with the same model and I need to support it.

    I tried to create a app.config with two backends configurations but in the Wizard I can´t see this configurations to choose Oracle to update model from the database.

    How can I proceed to maintain compatibility with two different databases with the exact same model ?

  2. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 13 May 2011 Link to this post

    Hello Marcelo,

    The forum thread you mentioned actually refers to the "classic" approach of using OpenAccess. The visual designer does not have yet the capability of handling multiple backends in a single rlinq file. However, this is one of our goals for the following Q2 release.
    Until then, you can still switch the database server at runtime but this would only work in the cases when the two databases are 100% identical, in terms of table and column names as well as column types. If the databases differ in any way and this information is not available in the OpenAccess metadata (because currently we keep metadata for only one backend), this would lead to runtime errors. In order to switch the database you need to create a context instance and pass the appropriate connection string, as well as the backend configuration and metadata source. The code looks like this:

    string connection = "MyConnectionString";
    BackendConfiguration configuration = new BackendConfiguration();
    configuration.Backend = "oracle";
    MetadataSource source = AttributesMetadataSource.FromAssembly(typeof(Product).Assembly);
     
    using (MyContext context = new MyContext(connection, configuration, source))
    {
        ...
    }
    I hope that helps.

    Kind regards,
    Alexander
    the Telerik team
    Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
  3. DevCraft banner
  4. Mulham
    Mulham avatar
    5 posts
    Member since:
    Mar 2007

    Posted 31 Jul 2011 Link to this post

    Hello,
    Has this feature (having SQL server and Oracle side by side in the same model) been shipped in Q2? do you have any resources that can help me start up with this.

    thanks,
    Mulham
  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 03 Aug 2011 Link to this post

    Hello Mulham,

    Unfortunately the multi-backend functionality did not make it for the Q2 release. However, it is still with highest priority and we will try to provide it till the end of the year.
    Please excuse us for the inconvenience caused.

    Greetings,
    Alexander
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  6. _TBS_
    _TBS_ avatar
    3 posts
    Member since:
    Nov 2011

    Posted 04 Jun 2013 Link to this post

    Any update on this topic? I have OpenAccess Q1 2013... Thank you!
  7. Marcelo
    Marcelo avatar
    13 posts
    Member since:
    Feb 2011

    Posted 04 Jun 2013 Link to this post

    I started using NHibernate
  8. _TBS_
    _TBS_ avatar
    3 posts
    Member since:
    Nov 2011

    Posted 05 Jun 2013 Link to this post

    And are you happy about it? Does it do what you requested initially?
  9. Marcelo
    Marcelo avatar
    13 posts
    Member since:
    Feb 2011

    Posted 05 Jun 2013 Link to this post

    Yes, I've used before, but the customer sent using Telerik's ORM, but because of this and other problems returned to NHIbernate.

    I do not know if the current version of this has already been solved
  10. Ivailo
    Admin
    Ivailo avatar
    318 posts

    Posted 05 Jun 2013 Link to this post

    Hi,

    While a single model linked to two databases is still not supported, note that we have added a crucial feature to Telerik OpenAccess ORM that would allow you to change the database during runtime. It is called Backend Independent Mapping and is available through our Fluent Mapping API. It ensures that the types you have are defined in a way that allows multiple databases to be mapped to the same model without having to re-adjust the types.

    In general, our recommendation for Visual Designer scenarios is to use two different RLINQ files for the two databases. Together with the Update from Database wizard, this approach would ensure that in case there are changes in one of the databases, which are not applied to the other, you won't risk any runtime exceptions such as missing tables or columns.

    Let us know if you need any guidance on implementing this or any other scenario with OpenAccess ORM.

     

    Regards,
    Ivailo
    Telerik
    OpenAccess Samples Kit boasts 50+ sample applications providing diverse real-life business solutions. Click to read more and see OpenAccess ORM in action.
Back to Top
DevCraft banner