Oracle 30 character limit revisited

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
rmagruder
Posts: 47
Joined: Thu 26 Jun 2014 17:12

Oracle 30 character limit revisited

Post by rmagruder » Tue 29 Jul 2014 18:29

Code: Select all

<Devart.Data.Oracle.Entity xmlns="http://devart.com/schemas/Devart.Data.Oracle.Entity/1.0">
    <CodeFirstOptions TruncateLongDefaultNames="true" AddTableNameInDefaultIndexName="false"/>
  </Devart.Data.Oracle.Entity>
I have this section registered and included in my EF 6 DAL assembly.

And yet, I still get:

Index name 'IX_Coupon_CouponRedemptionRuleId' in table MASTER.PURCHASEBASE_T is too long (32 characters). An identifier with more than 30 characters was specified.

When I call update-database. Shouldn't it have been truncated? Is there any other way to get a shorter Index name?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Oracle 30 character limit revisited

Post by MariiaI » Wed 30 Jul 2014 13:30

rmagruder wrote:

Code: Select all

<Devart.Data.Oracle.Entity xmlns="http://devart.com/schemas/Devart.Data.Oracle.Entity/1.0">
    <CodeFirstOptions TruncateLongDefaultNames="true" AddTableNameInDefaultIndexName="false"/>
  </Devart.Data.Oracle.Entity>
I have this section registered and included in my EF 6 DAL assembly.
If we understood you correctly, your application consists of several projects, and the definitions of the context and entity classes, the *.config file with the CodeFirstOptions are located in one of these projects (not the StartUp one). If yes, this behaviour may occur in case if the *.config file of the main project (the StartUp project) doesn't contain the necessary information in it, e.g. the EF provider registration, the CodeFirstOptions, etc.
Thus, please try adding the code you have mentioned above to the *.config file of the StartUp project and tell us if this helps.

rmagruder
Posts: 47
Joined: Thu 26 Jun 2014 17:12

Re: Oracle 30 character limit revisited

Post by rmagruder » Wed 30 Jul 2014 16:37

I will definitely do that, but it does raise an interesting question.

When you make a standalone assembly that contains your model and context, and you have other assemblies using it, let's say you have:

Assembly 1: EF Model and Context
Assembly 2: Web API service referencing Assembly 1

When you do these operations, which assembly's config files are the ones used?
1. Code First Migration
2. Add Controller to Web API service

I've had no end of trouble trying to keep the ASP.NET Web API 2.2 "Add Controller" functionality working against my EF assembly. Keep getting code generator errors with utterly unhelpful messages like "Element not found in sequence", with no information about what, exactly, in my EF assembly is the problem. I've seen some posts where people claim it's the db connection, but all their examples are in SQL Server and swapping between Sql Server CE and SQL Server drivers. It would certainly help to know which config file I'm supposed to be focused on in solutions like this.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Oracle 30 character limit revisited

Post by MariiaI » Fri 01 Aug 2014 12:22

The *.config file of the main project of your solution (Startup project) is used and all the necessary information is get from this file. This is the question of the application's architecture.
Please refer to http://stackoverflow.com/questions/2153 ... ill-it-use
Please also refer to http://coding.abel.nu/2012/03/ef-migrat ... reference/ :
-StartupProjectName: specifies the target project to look for a configuration file containing a connection string. If not specified the Visual Studio solution startup project is used.

Also, you can specify config options in the code. For example:

Code: Select all

var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
config.CodeFirstOptions.TruncateLongDefaultNames = true;
Don’t forget to add the Devart.Data.Oracle.Entity.dll assembly as Reference for the corresponding Entity Framework version.

Post Reply