Oracle

Oracle support is available for Serene 2.2.2+

Registering Oracle Provider

Oracle has a managed .NET provider named Oracle.ManagedDataAccess. You need to first install it in MyProject.Web:

Install-Package Oracle.ManagedDataAccess -Project MyProject.Web

If you didn’t install this provider in GAC/machine.config before, or don’t want to install it there, you need to register it in web.config file (Oracle.ManagedDataAccess NuGet package already does this on install):

  1. <configuration>
  2. // ...
  3. <system.data>
  4. <DbProviderFactories>
  5. <remove invariant="Oracle.ManagedDataAccess.Client"/>
  6. <add name="ODP.NET, Managed Driver"
  7. invariant="Oracle.ManagedDataAccess.Client"
  8. description="Oracle Data Provider for .NET, Managed Driver"
  9. type="Oracle.ManagedDataAccess.Client.OracleClientFactory,
  10. Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral,
  11. PublicKeyToken=89b483f429c47342"/>
  12. </DbProviderFactories>
  13. </system.data>
  14. // ...

Creating Databases

Serene can’t autocreate database (tablespace) for Oracle. You might create them yourself, or use a script like below (i used this for XE):

  1. CREATE TABLESPACE Serene_Default_v1_TABS
  2. DATAFILE 'Serene_Default_v1_TABS.dat' SIZE 10M AUTOEXTEND ON;
  3. CREATE TEMPORARY TABLESPACE Serene_Default_v1_TEMP
  4. TEMPFILE 'Serene_Default_v1_TEMP.dat' SIZE 5M AUTOEXTEND ON;
  5. CREATE USER Serene_Default_v1
  6. IDENTIFIED BY somepassword
  7. DEFAULT TABLESPACE Serene_Default_v1_TABS
  8. TEMPORARY TABLESPACE Serene_Default_v1_TEMP;
  9. GRANT CREATE SESSION TO Serene_Default_v1;
  10. GRANT CREATE TABLE TO Serene_Default_v1;
  11. GRANT CREATE SEQUENCE TO Serene_Default_v1;
  12. GRANT CREATE TRIGGER TO Serene_Default_v1;
  13. GRANT UNLIMITED TABLESPACE TO Serene_Default_v1;
  14. CREATE TABLESPACE Serene_Northwind_v1_TABS
  15. DATAFILE 'Serene_Northwind_v1_TABS.dat' SIZE 10M AUTOEXTEND ON;
  16. CREATE TEMPORARY TABLESPACE Serene_Northwind_v1_TEMP
  17. TEMPFILE 'Serene_Northwind_v1_TEMP.dat' SIZE 5M AUTOEXTEND ON;
  18. CREATE USER Serene_Northwind_v1
  19. IDENTIFIED BY somepassword
  20. DEFAULT TABLESPACE Serene_Northwind_v1_TABS
  21. TEMPORARY TABLESPACE Serene_Northwind_v1_TEMP;
  22. GRANT CREATE SESSION TO Serene_Northwind_v1;
  23. GRANT CREATE TABLE TO Serene_Northwind_v1;
  24. GRANT CREATE SEQUENCE TO Serene_Northwind_v1;
  25. GRANT CREATE TRIGGER TO Serene_Northwind_v1;
  26. GRANT UNLIMITED TABLESPACE TO Serene_Northwind_v1;

Setting Connection Strings

You might want to configure your data sources for ORACLE. I used Express Edition (XE) here:

  1. <configuration>
  2. <oracle.manageddataaccess.client>
  3. <version number="*">
  4. <dataSources>
  5. <dataSource alias="XE"
  6. descriptor="
  7. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)
  8. (HOST=localhost)(PORT=1521))
  9. (CONNECT_DATA=(SERVICE_NAME=XE))) "/>
  10. </dataSources>
  11. </version>
  12. </oracle.manageddataaccess.client>
  13. </configuration>

Next step is to replace connection strings for databases you want to use with Oracle:

Make sure you replace connection string parameters with values for your server

  1. <connectionStrings>
  2. <add name="Default" connectionString="
  3. Data Source=XE;User Id=Serene_Default_v1;Password=somepassword;"
  4. providerName="Oracle.ManagedDataAccess.Client"/>
  5. <add name="Northwind" connectionString="
  6. Data Source=XE;User Id=Serene_Northwind_v1;Password=somepassword;"
  7. providerName="Oracle.ManagedDataAccess.Client"/>
  8. </connectionStrings>

Provider name must be Oracle.ManagedDataAccess.Client for Serenity to auto-detect dialect. Read notes above to override default dialect.

Configuring Code Generator

Sergen doesn’t have support for Oracle yet, hopefully coming soon…