DevArt Entity Model, how to change nls_language on connect?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 33
Joined: Thu 20 May 2010 08:57
Location: Wales, UK.

DevArt Entity Model, how to change nls_language on connect?

Post by r.m.saddler » Fri 22 Oct 2010 07:59


I have a webserver that talks to multiple oracle databases. One of these databases has a different nls_language setting to the others so historically when we have communicated with it using .net we have had to issue an "EXECUTE IMMEDIATE ('ALTER SESSION SET NLS_LANGUAGE=american');" so that PLSQL operates correctly.

My latest project uses a Devart Entity Model with a LinqToEntitiesDomainService(Of TEntities) and I would like to know where I should run this command in code so that all calls subsequently made to the database operate as expected?

Many thanks,


Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 22 Oct 2010 11:59

In case you are using Entity Framework v4, you can simply use the ExecuteStoreCommand method.
And anyway, you can get the store connection from the objectContextInstance.Connection property and then use it like in the following sample:

Code: Select all

var connection = ((EntityConnection)(objectContextInstance.Connection)).StoreConnection; 
var command = connection.CreateCommand();
Put this code in the OnCreated method of your ObjectContext (don't forget the condition of the server name with different NLS_LANG settings).

Post Reply