locked
Connecting to external database & Isolation Level RRS feed

  • Question

  • We've been testing our plugin solution with CRM on-premises and everything was working with IsolationLevel set to "SandBoxed".

    We've just been asked to add some logic that will require us to connect to an external database using ADO.Net.   The first attempt we tried didn't work since the IsolationLevel setting was causing the following error:  Request for the permission of type 'System.Data.SqlClient.SqlClientPermission' failed.   Once we changed the IsolationLevel to "None" the new code worked without issue.

    At this point, I have a few questions:

    1) Is there any way to connect to a SQL database when the IsolationLevel is set to SandBoxed?

    2) If there is a way, which is the preferable approach to take?

    Monday, February 10, 2014 7:47 PM

Answers

  • The asnwers are quite simple:

    1) No. Microsoft provide no means to customise the code-access security levels of code in the sandbox

    2) The easy solution is to not use the sandbox. The only way to access external data from the sandbox is to call an unathenticated web service. You could write such a web service to provide the access to the database, but it seems a lot of work


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    • Marked as answer by Cipher Tuesday, February 11, 2014 4:36 PM
    Monday, February 10, 2014 10:07 PM
    Moderator

All replies

  • The asnwers are quite simple:

    1) No. Microsoft provide no means to customise the code-access security levels of code in the sandbox

    2) The easy solution is to not use the sandbox. The only way to access external data from the sandbox is to call an unathenticated web service. You could write such a web service to provide the access to the database, but it seems a lot of work


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    • Marked as answer by Cipher Tuesday, February 11, 2014 4:36 PM
    Monday, February 10, 2014 10:07 PM
    Moderator
  • Thanks, David.  I'll keep the IsolationLevel set to "None" for this one and keep the web services idea in mind for future CRM Online development, where we are forced to use the "Sandboxed" mode.
    • Edited by Cipher Tuesday, February 11, 2014 4:37 PM
    Tuesday, February 11, 2014 4:36 PM