Hi, I'm using Visual Studio 2015, with all updates, Firebird ADO.Net 5.8.1 and Entity Framework 6.1.3.
I'm trying to generate an EF6 object by using Code First from Database. One table is causing an error when it is trying to generate the code. Up to now, the other tables that I generated the EF6 code for, by using the Code First from Database template, worked properly. Here's the call stack generated within Visual Studio: Microsoft Visual Studio An error occurred generating the Code First model. The error occurred generating the contents of TempModel1.cs. System.ArgumentOutOfRangeException: MaxLength must be greater than zero. Parameter name: maxLength at System.Data.Entity.Core.Metadata.Edm.TypeUsage.ValidateMaxLength(Int32 maxLength) at System.Data.Entity.Core.Metadata.Edm.TypeUsage.CreateStringTypeUsage(PrimitiveType primitiveType, Boolean isUnicode, Boolean isFixedLength, Int32 maxLength) at FirebirdSql.Data.EntityFramework6.FbProviderManifest.GetStoreType(TypeUsage emeype) in C:\Users\JirflDocuments\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbProviderManifest.cs:line 350 at Microsoft.Data.Entity.Design.CodeGeneration.ColumnDiscoverer.Discover(Ederoperty property, DbModel model) at Microsoft.Data.Entity.Design.CodeGeneration.Edeelper.<> c_DisplayClass5_0.< GetConfigurations> b_0(IPropertyConfigurationDiscoverer f) at System.Linq.Enumerable.WhereSelectArraylterator‘ZMoveNextO at System.Linq.Enumerable.WhereEnumerablelterator‘l .MoveNextO at System.Linq.Enumerable.< 0FI'ypelterator> d_92‘1 .MoveNextO at System.Linq.Enumerable.WhereEnumerablelterator‘l .MoveNextO at Microsoft.Data.Entity.Design.CodeGeneration.DefaultCSharpContextGenerator.TransformText0 at Microsoft.Data.Entity.Design.CodeGeneration.DefaultCSharpContextGenerator.Generate(DbModel model, String codeNamespace, String contextClassName, String connectionStringName) at Microsoft.Data.Entity.Design.CodeGeneration.CodeFirstModelGenerator.< Generate) d_3.MoveNext0 And, here's the definition of the table that I'm having a problem with: CREATE TABLE CLAIMSDETAIL ( SERVICENO INTEGER NOT NULL, FILOPTOHCFACLAIMNO INTEGER, DATESTART TIMESTAMP, DATEEND TIMESTAMP, PLACEOFSERVICE VARCHAR(2), TYPEOFSERVICE VARCHAR(2), HCPCS_CPTCODE VARCHAR(5), MODIFIER1 VARCHAR(2), MODIFIER2 VARCHAR(5), DIAGNOSISCODE VARCHAR(1), CHARGES CURRENCY, DAYSORUNITS VARCHAR(2), EPSDTFAMILYPLAN VARCHAR(2), EMG VARCHAR(2), COB VARCHAR(2), LOCALUSE VARCHAR(8), MODIFIEDDATE TIMESTAMP, MODIFIEDBY USERNAMETYPE, INVOICEDETAILITEMNO INTEGER, MODIFIER3 CPT_CODE_MODIFIER, MODIFIER4 CPT_CODE_MODIFIER, DIAGNOSTIC_CODE VARCHAR(10), DIAGNOSIS_CODE_POINTER_1 INTEGER, DIAGNOSIS_CODE_POINTER_2 INTEGER, DIAGNOSIS_CODE_POINTER_3 INTEGER, DIAGNOSIS_CODE_POINTER_4 INTEGER, SERVICE_SEQUENCE_NO INTEGER DEFAULT 1, ESPDT CHAR(2), SUPPLEMENTAL_INFORMATION VARCHAR(80), UC_DIAGNOSIS_CODE_1 ICD9_CODE, UC_DIAGNOSIS_CODE_2 ICD9_CODE, UC_DIAGNOSIS_CODE_3 ICD9_CODE, UC_DIAGNOSIS_CODE_4 ICD9_CODE, DIAGNOSIS_CODES COMPUTED BY ( coalesce(iif(diagnosis_code_pointer_1>0, diagnosis_code_pointer_1, ''),'')||coalesce(iif(diagnosis_code_pointer_2>0, diagnosis_code_pointer_2, ''),'')||coalesce(iif(diagnosis_code_pointer_3>0, diagnosis_code_pointer_3, ''),'')||coalesce(iif(diagnosis_code_pointer_4>0, diagnosis_code_pointer_4, ''),'') ), DIAGNOSIS_02_12_CODE_POINTER_1 COMPUTED BY ( case diagnosis_code_pointer_1 when 1 then 'A' when 2 then 'B' when 3 then 'C' when 4 then 'D' when 5 then 'E' when 6 then 'F' when 7 then 'G' when 8 then 'H' when 9 then 'I' when 10 then 'J' when 11 then 'K' when 12 then 'L' end ), DIAGNOSIS_02_12_CODE_POINTER_2 COMPUTED BY ( case diagnosis_code_pointer_2 when 1 then 'A' when 2 then 'B' when 3 then 'C' when 4 then 'D' when 5 then 'E' when 6 then 'F' when 7 then 'G' when 8 then 'H' when 9 then 'I' when 10 then 'J' when 11 then 'K' when 12 then 'L' end ), DIAGNOSIS_02_12_CODE_POINTER_3 COMPUTED BY ( case diagnosis_code_pointer_3 when 1 then 'A' when 2 then 'B' when 3 then 'C' when 4 then 'D' when 5 then 'E' when 6 then 'F' when 7 then 'G' when 8 then 'H' when 9 then 'I' when 10 then 'J' when 11 then 'K' when 12 then 'L' end ), DIAGNOSIS_02_12_CODE_POINTER_4 COMPUTED BY ( case diagnosis_code_pointer_4 when 1 then 'A' when 2 then 'B' when 3 then 'C' when 4 then 'D' when 5 then 'E' when 6 then 'F' when 7 then 'G' when 8 then 'H' when 9 then 'I' when 10 then 'J' when 11 then 'K' when 12 then 'L' end )); ALTER TABLE CLAIMSDETAIL ADD CONSTRAINT PK_CLAIMSDETAIL PRIMARY KEY (SERVICENO); CREATE UNIQUE INDEX CLAIMSDETAIL0 ON CLAIMSDETAIL(FILOPTOHCFACLAIMNO,SERVICENO); CREATE INDEX IDX_CLAIMSDETAIL ON CLAIMSDETAIL(FILOPTOHCFACLAIMNO); CREATE INDEX IDX_CLAIMSDETAIL1 ON CLAIMSDETAIL(INVOICEDETAILITEMNO); CREATE INDEX I_CLAIMSDETAIL_DATESTART ON CLAIMSDETAIL(DATESTART); Any help would be appreciated. Also, this table is used as is within our Delphi code for at least 5 years, and we do not want to change that code. -- Best regards, Daniel Rail Senior System Engineer ACCRA Solutions Inc. (www.accra.ca) ACCRA Med Software Inc. (www.filopto.com) ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider