Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Entity framework core beta - how to avoid quotes being generated in sql

user5716448Apr 29 2019 — edited Apr 30 2019

Hi,

using entity framework core beta and getting table or view does not exist as quotes being generated in the sql and this alos gives same error when run on database.

How can we ensure ef core beta generates the sql without quotes around the identifier thus allowing the sql to work e.g is there a disable quotes switch or something similar?

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)

Microsoft.EntityFrameworkCore.Database.Command:Error: Failed executing DbCommand (137ms) [Parameters=[], CommandType='Text', CommandTimeout='0']

SELECT "m"."MULT_MULTIPLE_CODE", "m"."MULT_ANMW_MULTIPLE_CODE", "m"."MULT_AUTH_REQUIRED", "m"."MULT_JMW_MULTIPLE_TYPE_CODE", "m"."MULT_LINK_MULTIPLE_CODE", "m"."MULT_NAME", "m"."MULT_PROM_AUTH_REQUIRED", "m"."MULT_SELECTED_MULTIPLE"

FROM "Multiple" "m"

As a workaround changed the text in the solution to MULTIPLE rather than Multiple and gets past this stage

next error is The expected type was 'System.Int32' but the actual value was null.

An exception occurred in the database while iterating the results of a query for context type 'RazorPagesMultiple.Models.RazorPagesMultipleContext'.

RazorPagesMultiple>       System.InvalidOperationException: An exception occurred while reading a database value for property 'MULTIPLE.MULT_LINK_MULTIPLE_CODE'. The expected type was 'System.Int32' but the actual value was null. ---> System.NullReferenceException: Object reference not set to an instance of an object.

RazorPagesMultiple>          at Microsoft.EntityFrameworkCore.Metadata.Internal.EntityMaterializerSource.TryReadValue[TValue](ValueBuffer& valueBuffer, Int32 index, IPropertyBase property)

RazorPagesMultiple>          --- End of inner exception stack trace ---

How can we resolve this - definition of class below

namespace RazorPagesMultiple.Models

{

    //public class Multiple

    public class MULTIPLE

    {

        [Key]

        public int MULT_MULTIPLE_CODE { get; set; }

        [StringLength(60, MinimumLength = 6)]

        [Required] public string MULT_NAME { get; set; }

        public string MULT_SELECTED_MULTIPLE { get; set; }

        public string MULT_ANMW_MULTIPLE_CODE { get; set; }

        public int MULT_LINK_MULTIPLE_CODE { get; set; }

        public string MULT_JMW_MULTIPLE_TYPE_CODE { get; set; }

        public string MULT_AUTH_REQUIRED { get; set; }

        public string MULT_PROM_AUTH_REQUIRED { get; set; }

    }

}

changed int to int?  and got pas this stage.

Comments

Post Details

Added on Apr 29 2019
2 comments
1,710 views