This is a migrated thread and some comments may be shown as answers.

Code First on designer

2 Answers 64 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
rd
Top achievements
Rank 1
rd asked on 22 May 2012, 03:10 PM
Hello, when using code first the following is generated:

.IsNotNullable().HasColumnType("varchar").HasLength(100)


The problem is that using like this I cannot use the model with an Oracle DB.
Any option in the designer so it don't generate VARCHAR ?

2 Answers, 1 is accepted

Sort by
0
rd
Top achievements
Rank 1
answered on 23 May 2012, 02:46 PM
I've tried to remove the HasColumnType("varchar")

but got:

The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 13 ("@p9"): Data type 0xE7 has an invalid data length or metadata length.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Telerik.OpenAccess.RT.sql.SQLException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 13 ("@p9"): Data type 0xE7 has an invalid data length or metadata length.
0
Jan Blessenohl
Telerik team
answered on 25 May 2012, 01:05 PM
Hi,

Today I can only provide you a workaround. You can manipulate the metadata before you open the database the first time. You can use the default mapping for oracle or replace the sql types with explicit values. To use our default mapping you can create a partial class to your generated context class and override the OnDatabaseOpen method like this:

public partial class NorthwindModel
{
    protected override void OnDatabaseOpen(BackendConfiguration backendConfiguration, MetadataContainer metadataContainer)
    {
        // oracle
        if (connectionString.ToLowerInvariant().Contains("oracle")) // derive the oracle setting from something like the connection string!
        {
            foreach (var c in metadataContainer.Tables.SelectMany(x => x.Columns))
                c.SqlType = null;
            foreach (var i in metadataContainer.Indexes)
                i.Name = null;
        }
        base.OnDatabaseOpen(backendConfiguration, metadataContainer);
    }



All the best,
Jan Blessenohl
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
Design Time (Visual Designer & Tools)
Asked by
rd
Top achievements
Rank 1
Answers by
rd
Top achievements
Rank 1
Jan Blessenohl
Telerik team
Share this question
or