Search found 22 matches

by TheCoolest
Sun 18 Sep 2022 11:29
Forum: dotConnect for Oracle
Topic: Issue with TruncateLongDefaultNames on Oracle 19
Replies: 7
Views: 21195

Re: Issue with TruncateLongDefaultNames on Oracle 19

You will most likely need to open a formal ticket. I couldn't get a reply on the forum for months until I did.
by TheCoolest
Fri 12 Aug 2022 08:05
Forum: dotConnect for Oracle
Topic: Incorrect translation results in ORA-00904 in complex LINQ query
Replies: 3
Views: 11748

Re: Incorrect translation results in ORA-00904 in complex LINQ query

Can anyone give an update? It's been over 2 months.
by TheCoolest
Fri 12 Aug 2022 08:05
Forum: dotConnect for Oracle
Topic: A valid use of UseTransaction throws an exception
Replies: 3
Views: 10175

Re: A valid use of UseTransaction throws an exception

Can anyone give an update? It's been over 2 months.

Also, please get rid of the spam one post above.
by TheCoolest
Tue 19 Jul 2022 07:11
Forum: dotConnect for Oracle
Topic: Incorrect translation results in ORA-00904 in complex LINQ query
Replies: 3
Views: 11748

Re: Incorrect translation results in ORA-00904 in complex LINQ query

I'm still waiting for a response. This is affecting our release plans.
by TheCoolest
Mon 04 Jul 2022 15:22
Forum: dotConnect for Oracle
Topic: A valid use of UseTransaction throws an exception
Replies: 3
Views: 10175

Re: A valid use of UseTransaction throws an exception

Any updates on this? This issue was not resolved in 10.0.0.
by TheCoolest
Thu 09 Jun 2022 15:49
Forum: dotConnect for Oracle
Topic: A valid use of UseTransaction throws an exception
Replies: 3
Views: 10175

A valid use of UseTransaction throws an exception

This is another regression we are seeing after switching from 9.14.1180 on .NET Core 3.1 to 9.16.1434 and .NET 6.
Although the way to reproduce it is a bit convoluted, it used to work correctly with the older build, and it works properly with MSSQL and SQLite.
Exception:

Code: Select all

Unhandled exception. System.InvalidOperationException: The specified transaction is not associated with the current connection. Only transactions associated with the current connection may be used.
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction..ctor(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger`1 logger, Boolean transactionOwned, ISqlGenerationHelper sqlGenerationHelper)
   at Devart.Common.Entity.c0..ctor(IRelationalConnection A_0, DbTransaction A_1, Guid A_2, IDiagnosticsLogger`1 A_3, Boolean A_4, ISqlGenerationHelper A_5)
   at Devart.Data.Oracle.Entity.at..ctor(IRelationalConnection A_0, DbTransaction A_1, Guid A_2, IDiagnosticsLogger`1 A_3, Boolean A_4, ISqlGenerationHelper A_5)
   at Devart.Data.Oracle.Entity.au.Create(IRelationalConnection connection, DbTransaction transaction, Guid transactionId, IDiagnosticsLogger`1 logger, Boolean transactionOwned)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.CreateRelationalTransaction(DbTransaction transaction, Guid transactionId, Boolean transactionOwned)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.UseTransaction(DbTransaction transaction, Guid transactionId)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.UseTransaction(DatabaseFacade databaseFacade, DbTransaction transaction, Guid transactionId)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.UseTransaction(DatabaseFacade databaseFacade, DbTransaction transaction)
Code to reproduce:

Code: Select all

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Data.Common;

namespace efcore_demo
{
    class Program
    {
        static void Main(string[] args)
        {
            test_devart_fail_reuse_transaction_in_new_scope();
            Console.WriteLine("Hello World!");
        }

        private static void test_devart_fail_reuse_transaction_in_new_scope()
        {
            var sp = new devart_fail_reuse_transaction_in_new_scope.ServiceProviderWrapper(devart_fail_reuse_transaction_in_new_scope.DbType.Oracle);
            var seeder = new devart_fail_reuse_transaction_in_new_scope.Seeder(sp);
            seeder.Seed();
            var logic = new devart_fail_reuse_transaction_in_new_scope.Logic(sp);
            logic.ExecuteQuery();
        }
    }
        
    internal class devart_fail_reuse_transaction_in_new_scope
    {
        public enum DbType
        {
            Oracle,
            SQLite,
            MSSQL
        }

        public class ServiceProviderWrapper
        {
            private readonly IServiceProvider _serviceProvider;

            public IServiceProvider ServiceProvider => _serviceProvider;

            public ServiceProviderWrapper(DbType dbType)
            {
                _serviceProvider = new ServiceCollection()
                   .AddLogging(b => b.AddConsole())
                   .AddScoped<DbConnectionHolder>()
                   .AddDbContext<MyDbContext>((sp, options) =>
                   {
                       var conn = sp.GetService<DbConnectionHolder>();
                       options = options.EnableSensitiveDataLogging();
                       if (dbType == DbType.Oracle)
                       {
                           if (conn?.DbConnection != null)
                           {
                               options.UseOracle(conn.DbConnection);
                               System.Diagnostics.Debug.WriteLine("Using Oracle DbConnection: " + conn.DbConnection.ConnectionString);
                           }
                           else
                           {
                               options.UseOracle(OracleConstants.ORACLE_CONNECTION);
                               System.Diagnostics.Debug.WriteLine("Using Oracle hardcoded string");
                           }
                       }
                       else if (dbType == DbType.SQLite)
                       {
                           if (conn?.DbConnection != null)
                           {
                               options.UseSqlite(conn.DbConnection);
                               System.Diagnostics.Debug.WriteLine("Using SQLite DbConnection: " + conn.DbConnection.ConnectionString);
                           }
                           else
                           {
                               options.UseSqlite("Data Source=efcoredemo.db");
                               System.Diagnostics.Debug.WriteLine("Using SQLite hardcoded string");
                           }
                       }
                       else if (dbType == DbType.MSSQL)
                       {
                           if (conn?.DbConnection != null)
                           {
                               options.UseSqlServer(conn.DbConnection);
                               System.Diagnostics.Debug.WriteLine("Using MSSQL DbConnection: " + conn.DbConnection.ConnectionString);
                           }
                           else
                           {
                               options.UseSqlServer("Server=(localdb)\\ProjectsV13;Database=devart_fail_reuse_transaction_in_new_scope;Trusted_Connection=True;MultipleActiveResultSets=true");
                               System.Diagnostics.Debug.WriteLine("Using MSSQL hardcoded string");
                           }
                       }
                   }, ServiceLifetime.Scoped)
                   .BuildServiceProvider();
            }
        }

        public class Logic
        {
            private readonly ServiceProviderWrapper _serviceProviderWrapper;

            public Logic(ServiceProviderWrapper serviceProviderWrapper)
            {
                _serviceProviderWrapper = serviceProviderWrapper;
            }

            public void ExecuteQuery()
            {
                using (var parentScope = _serviceProviderWrapper.ServiceProvider.CreateScope())
                {
                    var parentScopeDbContext = parentScope.ServiceProvider.GetRequiredService<MyDbContext>();
                    var transaction = parentScopeDbContext.Database.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
                    using (var scope = parentScope.ServiceProvider.CreateScope())
                    {
                        var dbTransaction = parentScopeDbContext.Database.CurrentTransaction?.GetDbTransaction();
                        if (dbTransaction != null)
                        {
                            var conn = scope.ServiceProvider.GetRequiredService<DbConnectionHolder>();
                            conn.DbConnection = dbTransaction.Connection;
                            var dbContext = scope.ServiceProvider.GetRequiredService<MyDbContext>();
                            dbContext.Database.UseTransaction(dbTransaction);
                        }
                    }
                }
            }
        }

        internal class DbConnectionHolder
        {
            public DbConnection DbConnection { get; set; }
        }

        public class Seeder
        {
            private readonly ServiceProviderWrapper _serviceProviderWrapper;

            public Seeder(ServiceProviderWrapper serviceProviderWrapper)
            {
                _serviceProviderWrapper = serviceProviderWrapper;
            }

            public void Seed()
            {
                using (var scope = _serviceProviderWrapper.ServiceProvider.CreateScope())
                {
                    var dbContext = scope.ServiceProvider.GetService<MyDbContext>();
                    var rdc = dbContext.Database.GetService<IRelationalDatabaseCreator>();
                    if (rdc.Exists())
                        rdc.EnsureDeleted();
                    rdc.EnsureCreated();
                    if (!dbContext.Items.Any())
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            var rand = new Random();
                            int cat = rand.Next() % 3;
                            int colors = rand.Next() % 4;
                            var item = new Item { CategoryId = cat, Name = $"Item {i}" };
                            for (int c = 0; c <= colors; c++)
                            {
                                item.AddColor(c);
                            }
                            dbContext.Items.Add(item);
                        }
                    }
                    if (!dbContext.Categories.Any())
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            var category = new Category { Name = $"Category {i}" };
                            dbContext.Categories.Add(category);
                        }
                    }
                    dbContext.SaveChanges();
                }
            }
        }

        public class Dto
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public string Colors { get; set; }
        }

        public class Item
        {
            private readonly List<Color> _colors = new List<Color>();
            public IReadOnlyCollection<Color> Colors => _colors;
            public int Id { get; set; }
            public int CategoryId { get; set; }
            public string Name { get; set; }

            internal void AddColor(int i)
            {
                var color = new Color { Name = $"Color {i}" };
                _colors.Add(color);
            }
        }

        public class Color
        {
            public int ItemId { get; private set; }
            public virtual Item Item { get; private set; }
            public int Id { get; set; }
            public string Name { get; set; }
        }

        public class Category
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }

        public class MyDbContext : DbContext
        {
            public static readonly ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
            {
                builder.AddConsole();
            });

            public DbSet<Item> Items { get; set; }
            public DbSet<Color> Colors { get; set; }
            public DbSet<Category> Categories { get; set; }

            public MyDbContext(DbContextOptions options) : base(options)
            {
            }

            protected override void OnModelCreating(ModelBuilder modelBuilder)
            {
                modelBuilder.ApplyConfiguration(new ItemConfiguration());
                modelBuilder.ApplyConfiguration(new CategoryConfiguration());
            }
        }

        public class ItemConfiguration : IEntityTypeConfiguration<Item>
        {
            public void Configure(EntityTypeBuilder<Item> builder)
            {
                builder.ToTable("Item");
                builder.HasKey(o => o.Id);
                builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd();
                builder.Property(t => t.CategoryId).HasColumnName("categoryId");
                builder.Property(t => t.Name).HasColumnName("name");
            }
        }

        public class ColorConfiguration : IEntityTypeConfiguration<Color>
        {
            public void Configure(EntityTypeBuilder<Color> builder)
            {
                builder.ToTable("Color");
                builder.HasKey(o => o.Id);
                builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd();
                builder.Property(t => t.Name).HasColumnName("name");

                builder.HasOne(s => s.Item)
                    .WithMany(s => s.Colors)
                    .HasForeignKey(s => s.ItemId);
            }
        }

        public class CategoryConfiguration : IEntityTypeConfiguration<Category>
        {
            public void Configure(EntityTypeBuilder<Category> builder)
            {
                builder.ToTable("Category");
                builder.HasKey(o => o.Id);
                builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd();
                builder.Property(t => t.Name).HasColumnName("name");
            }
        }
    }
}
by TheCoolest
Thu 09 Jun 2022 11:06
Forum: dotConnect for Oracle
Topic: Incorrect translation results in ORA-00904 in complex LINQ query
Replies: 3
Views: 11748

Incorrect translation results in ORA-00904 in complex LINQ query

Up until now we've been using version 9.14.1180 modified to work with .NET Core 3.1 and everything was working OK.
Currently we are porting our backend to .NET6, using the latest available version (9.16.1434), and have encountered a regression.
Here is the error:

Code: Select all

Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (11ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
SELECT "c"."Name", (
  SELECT MAX("i0"."id")
  FROM "Item" "i0"
  CROSS JOIN "Colors" "c1"
  WHERE ("c1"."Id" = (
	  SELECT MAX("c2"."Id")
	  FROM "Colors" "c2")) AND (DBMS_LOB.COMPARE("c"."Name", "c1"."Name") = 0)) "Id"
FROM "Item" "i"
CROSS JOIN "Colors" "c"
WHERE "c"."Id" = (
  SELECT MAX("c2"."Id")
  FROM "Colors" "c0")
GROUP BY "c"."Name"
Microsoft.EntityFrameworkCore.Query[10100]
An exception occurred while iterating over the results of a query for context type 'efcore_demo.devart_bad_sql_translation_net6+MyDbContext'.
Devart.Data.Oracle.OracleException (0x80004005): ORA-00904: "c2"."Id": invalid identifier
 at Devart.Data.Oracle.cp.c(Int32 A_0)
 at Devart.Data.Oracle.ds.a(Int32 A_0)
 at Devart.Data.Oracle.ds.e5(Int32 A_0, bx A_1)
 at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
 at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
 at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
 at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
 at Devart.Data.Oracle.Entity.ao.by(CommandBehavior A_0)
 at Devart.Common.Entity.cs.ExecuteDbDataReader(CommandBehavior behavior)
 at Devart.Data.Oracle.Entity.ao.ExecuteDbDataReader(CommandBehavior behavior)
 at System.Data.Common.DbCommand.ExecuteReader()
 at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
 at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
 at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.<>c.<MoveNext>b__19_0(DbContext _, Enumerator enumerator)
 at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
 at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
Devart.Data.Oracle.OracleException (0x80004005): ORA-00904: "c2"."Id": invalid identifier
 at Devart.Data.Oracle.cp.c(Int32 A_0)
 at Devart.Data.Oracle.ds.a(Int32 A_0)
 at Devart.Data.Oracle.ds.e5(Int32 A_0, bx A_1)
 at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
 at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
 at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
 at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
 at Devart.Data.Oracle.Entity.ao.by(CommandBehavior A_0)
 at Devart.Common.Entity.cs.ExecuteDbDataReader(CommandBehavior behavior)
 at Devart.Data.Oracle.Entity.ao.ExecuteDbDataReader(CommandBehavior behavior)
 at System.Data.Common.DbCommand.ExecuteReader()
 at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
 at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
 at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.<>c.<MoveNext>b__19_0(DbContext _, Enumerator enumerator)
 at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
 at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
Sample code to reproduce:

Code: Select all

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.Logging;

namespace efcore_demo
{
    class Program
    {
        static void Main(string[] args)
        {
            test_devart_bad_sql_translation_net6();
            Console.WriteLine("Hello World!");
        }

        private static void test_devart_bad_sql_translation_net6()
        {
            var seeder = new devart_bad_sql_translation_net6.Seeder();
            seeder.Seed();
            var logic = new devart_bad_sql_translation_net6.Logic();
            var dtos = logic.ExecuteQuery();
        }
    }

    internal class devart_bad_sql_translation_net6
    {
        public class Logic
        {
            public IList<Dto> ExecuteQuery()
            {
                using (var dbContext = new MyDbContext())
                {
                    return (from i in dbContext.Items
                            from c in dbContext.Colors
                            where c.Id.Equals((
                                from c2 in dbContext.Colors
                                select c2.Id).Max())
                            group i by c.Name into g
                            select new Dto { Name = g.Key, Id = g.Max(x => x.Id) })
                            .ToList();
                }
            }
        }

        public class Dto
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public string Colors { get; set; }
        }

        public class Seeder
        {
            public void Seed()
            {
                using (var dbContext = new MyDbContext())
                {
                    var rdc = dbContext.Database.GetService<IRelationalDatabaseCreator>();
                    if (rdc.Exists())
                        rdc.EnsureDeleted();
                    rdc.EnsureCreated();
                    if (!dbContext.Items.Any())
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            var rand = new Random();
                            int cat = rand.Next() % 3;
                            int colors = rand.Next() % 4;
                            var item = new Item { CategoryId = cat, Name = $"Item {i}" };
                            for (int c = 0; c <= colors; c++)
                            {
                                item.AddColor(c);
                            }
                            dbContext.Items.Add(item);
                        }
                    }
                    if (!dbContext.Categories.Any())
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            var category = new Category { Name = $"Category {i}" };
                            dbContext.Categories.Add(category);
                        }
                    }
                    dbContext.SaveChanges();
                }
            }
        }

        public class Item
        {
            private readonly List<Color> _colors = new List<Color>();
            public IReadOnlyCollection<Color> Colors => _colors;
            public int Id { get; set; }
            public int CategoryId { get; set; }
            public string Name { get; set; }

            internal void AddColor(int i)
            {
                var color = new Color { Name = $"Color {i}" };
                _colors.Add(color);
            }
        }

        public class Color
        {
            public int ItemId { get; private set; }
            public virtual Item Item { get; private set; }
            public int Id { get; set; }
            public string Name { get; set; }
        }

        public class Category
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }

        public class MyDbContext : DbContext
        {
            public static readonly ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
            {
                builder.AddConsole();
            });

            public DbSet<Item> Items { get; set; }
            public DbSet<Color> Colors { get; set; }
            public DbSet<Category> Categories { get; set; }

            protected override void OnModelCreating(ModelBuilder modelBuilder)
            {
                modelBuilder.ApplyConfiguration(new ItemConfiguration());
                modelBuilder.ApplyConfiguration(new CategoryConfiguration());
            }

            private const string DEVART_LICENSE = "xxx";
            private readonly string ORACLE_CONNECTION = $"yyy; license key={DEVART_LICENSE};";
            protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
            {
                optionsBuilder
                    .UseLoggerFactory(loggerFactory)
                    .EnableSensitiveDataLogging()
                    //.UseSqlite("Data Source=efcoredemo.db");
                    .UseOracle(ORACLE_CONNECTION);
            }
        }

        public class ItemConfiguration : IEntityTypeConfiguration<Item>
        {
            public void Configure(EntityTypeBuilder<Item> builder)
            {
                builder.ToTable("Item");
                builder.HasKey(o => o.Id);
                builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd();
                builder.Property(t => t.CategoryId).HasColumnName("categoryId");
                builder.Property(t => t.Name).HasColumnName("name");
            }
        }

        public class ColorConfiguration : IEntityTypeConfiguration<Color>
        {
            public void Configure(EntityTypeBuilder<Color> builder)
            {
                builder.ToTable("Color");
                builder.HasKey(o => o.Id);
                builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd();
                builder.Property(t => t.Name).HasColumnName("name");

                builder.HasOne(s => s.Item)
                    .WithMany(s => s.Colors)
                    .HasForeignKey(s => s.ItemId);
            }
        }

        public class CategoryConfiguration : IEntityTypeConfiguration<Category>
        {
            public void Configure(EntityTypeBuilder<Category> builder)
            {
                builder.ToTable("Category");
                builder.HasKey(o => o.Id);
                builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd();
                builder.Property(t => t.Name).HasColumnName("name");
            }
        }
    }
}
SQLite (left) : Oracle (right)
Image
by TheCoolest
Fri 18 Feb 2022 11:12
Forum: dotConnect for Oracle
Topic: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'
Replies: 16
Views: 6735

Re: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'

Are you asking me? Clearly you've not read the thread.
We are now using 9.14.1180 with the modifications to make it work with .NET Core 3.1, and it works OK now.
by TheCoolest
Wed 03 Feb 2021 10:34
Forum: dotConnect for Oracle
Topic: Invalid SQL generation, ORA-00907: missing right parenthesis
Replies: 2
Views: 24361

Invalid SQL generation, ORA-00907: missing right parenthesis

We are using version 9.14.1180 with the changes suggested here: viewtopic.php?f=1&t=44230#p178438

Code: Select all

public class Client
{
	public User User { get; private set; }
	public int UserId { get; private set; }

	public int ClientId { get; private set; }
	// ... Other fields...
}

public class User
{
	private readonly List<Client> _clientsList = new List<Client>();
	public IReadOnlyCollection<Client>  ClientsList => _clientsList;

	public int UserId { get; private set; }
	public string IsUserActive { get; private set; }
	// ... Other fields...
}
The selector code we had was inadvertently modified, and lead to the ORA-00907 exception.
This does not happen with MSSQL and PostgreSQL, so we believe this is a bug with dotConnect.

The original code, which works fine:

Code: Select all

var clients = dbContext.Clients.Select(client => new ClientDto()
            {
                Id = client.Id,
                // ... Other fields...
                IsUserActive = client.User.IsActive.ToUpper() == BoolUtils.Y,
                UserName = client.User == null ? string.Empty : StringUtils.Sanitize(client.User.Name),
            });
The code that does not work with dotConnect, but does work ok with other providers.

Code: Select all

var clients = dbContext.Clients.Select(client => new ClientDto()
            {
                Id = client.Id,
                // ... Other fields...
                IsUserActive = client.User == null ? false : client.User.IsActive.ToUpper() == BoolUtils.Y,
                UserName = client.User == null ? string.Empty : StringUtils.Sanitize(client.User.Name),
            });
Here are the respective SQL code.
Works:

Code: Select all

SELECT "c".CLIENT_ID, (CASE
    WHEN (UPPER("u".US_IS_ACTIVE) = 'Y') AND UPPER("u".US_IS_ACTIVE) IS NOT NULL THEN 1
    ELSE 0
END), "u".USER_NAME
FROM CLIENTS "c"
INNER JOIN USERS "u" ON "c".USER_ID = "u".USER_ID
ORA-00907:

Code: Select all

SELECT "c".CLIENT_ID, (CASE
    WHEN 0 = 1 THEN 0
    ELSE (UPPER("u".US_IS_ACTIVE) = 'Y') AND UPPER("u".US_IS_ACTIVE) IS NOT NULL
END), "u".USER_NAME
FROM CLIENTS "c"
INNER JOIN USERS "u" ON "c".USER_ID = "u".USER_ID
We have reverted the changes in our code, which were not required, but I thought it important to let you know of a potential issue.
by TheCoolest
Mon 18 Jan 2021 15:02
Forum: dotConnect for Oracle
Topic: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'
Replies: 16
Views: 6735

Re: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'

Thank you, good to hear that there will be an official release with EF Core 3.1 support.

Your how-to worked, and it's good enough for developer-side testing, sadly it's not really suitable for our build environment.
Looks like the original problem was also fixed, so that's great.

We will be waiting for the next official release in order to be able to more easily switch to the most up-to-date version.
by TheCoolest
Mon 04 Jan 2021 08:07
Forum: dotConnect for Oracle
Topic: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'
Replies: 16
Views: 6735

Re: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'

We cannot downgrade to .NET Standard 2.0. Even when I add a separate project that is .NET Standard 2.0, and then reference it in a 2.1 project, the 2.1 project will still reference .NET 5.0 binaries and then fail to build.

There are several packages I have seen on the NuGet repository that offer 2 separate versions, one that works with .NET Core 3.1 and one that works with 5.0.
For example:
Most of Microsoft's packages.
Microsoft.EntityFrameworkCore.DynamicLinq. This is a good example. They have v3.2.7 for 3.1 and v5.2.7 for 5.0

Users in that thread had a different, but similar complaint, in the sense that the dependencies were changed, which made their projects incompatible with the new version of dotConnect.
by TheCoolest
Sun 03 Jan 2021 09:03
Forum: dotConnect for Oracle
Topic: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'
Replies: 16
Views: 6735

Re: UseOracle throws Unexpected connection type 'Devart.Data.Oracle.Entity.ao'

I have tried to update to the latest version, but the changes you've made to the dependencies broke our solution.
We use .NET Core 3.1 and .NETStandard2.1 libraries, and do not want to upgrade to .NET 5.0.
Our solution is comprised from multiple projects, and manually adding an assembly reference to the "non-nuget" version of dotConnect in each and every one of them that requires it is completely impractical.
From the 30-40 or so other nugets we employ, we only have this problem with yours.
Up until this point, we had a single nuget reference to dotConnect up in the project hierarchy, and everything worked fine.
I have went over this topic viewtopic.php?f=1&t=39879 and I see that we are not the only ones who are unhappy with the recent changes.
It would be nice to perhaps have 2 different nugets to address this, or any other solution that would not force us to add assembly references to many of our projects.