Directly parameterized literal boolean eq/neq expression found AGAIN

2 posts, 0 answers
  1. Igor
    Igor avatar
    13 posts
    Member since:
    Jul 2011

    Posted 28 Dec 2011 Link to this post

    Hi
    I try rewrite some code with yours Fluent API (with 2011.3.1213.3 on MS SQL Server).
    My test code  ...

    CREATE TABLE [dbo].[_AldaAppOptions2](

          [oID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,

          [Key] [nvarchar](max) NOT NULL,

          [Value] [ntext] NULL,

          [ValueType] [nvarchar](max) NULL,

          [Version] [int] NOT NULL,

          [TimeStamp] [datetime] NOT NULL,

     CONSTRAINT [PK__AldaAppOptions2] PRIMARY KEY CLUSTERED

    (

          [oID] ASC

    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]



        public class AppOptions

        {

                 public Guid oID { get; set; }

                 public string Key { get; set; }

                 public string Value { get; set; }

                 public string ValueType { get; set; }

                 public int Version { get; set; }

                 public DateTime TimeStamp { get; set; }

        }

       public class AppOptionsMetadataSource : FluentMetadataSource

        {

            protected override IList<MappingConfiguration> PrepareMapping()

            {

                // Getting Started with the Fluent Mapping API

                // http://www.telerik.com/help/openaccess-orm/fluent-mapping-overview.html

     

                List<MappingConfiguration> configurations = new List<MappingConfiguration>();

     

                MappingConfiguration<AppOptions> appOptionsConfiguration = new MappingConfiguration<AppOptions>();

                appOptionsConfiguration.MapType(x => new

                {

                    oID = x.oID,

                    Key = x.Key,

                    Value = x.Value,

                    ValueType = x.ValueType,

                    Version = x.Version,

                    TimeStamp = x.TimeStamp,

                }).ToTable("_AldaAppOptions2");

                appOptionsConfiguration.HasProperty(x => x.oID).IsIdentity(KeyGenerator.Guid);

     

                configurations.Add(appOptionsConfiguration);

     

     

                return configurations;

            }

        }

     

        class Program

        {

            static void Main(string[] args)

            {

                try

                {

                    var connectionInfo = DbConnection.ConnectionInfo.Load();

                    if (connectionInfo == null)

                        throw new ArgumentNullException("connectionInfo");

                    var context = new AppOptionsContext(connectionInfo);

                    {

                        var majorVersion = 1 << 24;

                        var options = context.AppOptions.Where((a) => (a.Version & 0x7000000) == majorVersion);

                        foreach (var rec in options)

                        {

                            Debug.WriteLine(rec.Key + "  " + rec.Value);

                        }

                    }

                    Console.ReadKey();

                }

                catch (Exception ex)

                {

                    Debug.WriteLine(ex);

                }

            }

    }

    Error …

    DbConnectionProvider List CLR=v2.0.50727 32bit

    'System.Data.Odbc' => 'System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    'System.Data.OleDb' => 'System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    'System.Data.OracleClient' => 'System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    'System.Data.SqlClient' => 'System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    'System.Data.SqlServerCe.3.5' => 'System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'

    'Alda.OpenAccess.AppOptions.ConsoleTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\WindowsBase\3.0.0.0__31bf3856ad364e35\WindowsBase.dll'

    A first chance exception of type 'Telerik.OpenAccess.OpenAccessException' occurred in Telerik.OpenAccess.dll

    A first chance exception of type 'Telerik.OpenAccess.OpenAccessException' occurred in Telerik.OpenAccess.Runtime.dll

    A first chance exception of type 'Telerik.OpenAccess.OpenAccessException' occurred in Telerik.OpenAccess.dll

    A first chance exception of type 'Telerik.OpenAccess.OpenAccessException' occurred in Telerik.OpenAccess.35.Extensions.dll

    A first chance exception of type 'System.InvalidOperationException' occurred in Telerik.OpenAccess.35.Extensions.dll

    System.InvalidOperationException: An exception occured during the execution of '

    Extent<Alda.OpenAccess.AppOptions.AppOptions>().Where(a => ((a.Version & 117440512) = value(Alda.OpenAccess.AppOptions.ConsoleTest.Program+<>c__DisplayClass0).majorVersion))'.

    Failure: Directly parameterized boolean eq/neq expression found for 'AndNode eq/neq ParamNodeProxy'.

     ---> Telerik.OpenAccess.OpenAccessException: Directly parameterized boolean eq/neq expression found for 'AndNode eq/neq ParamNodeProxy'.

       в Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQueryImpl(Type type, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single, Boolean checkOid)

       в Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQuery(Type type, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single, Boolean checkOid)

       --- Конец трассировки внутреннего стека исключений ---

       в Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQuery(Type type, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single, Boolean checkOid)

       в Telerik.OpenAccess.Query.ExpressionExecution.PerformDatabaseQueryMulti[T](Expression expr, ExecutionSettings settings, Object[] grpVals, Boolean checkOid)

       в Telerik.OpenAccess.Query.Piece`1.ExecuteMultiple()

       в Telerik.OpenAccess.Query.Piece`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()

       в Alda.OpenAccess.AppOptions.ConsoleTest.Program.Main(String[] args) в D:\Development\svn.dev.net\Configuration\Alda.OpenAccess.AppOptions.ConsoleTest\Program.cs:строка 20


  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 30 Dec 2011 Link to this post

    Hi,

     Unfortunately pushing bitwise operations trough a LINQ query to the server is not currently supported and this is why you get such an exception, that I agree can (and will) be improved. I am sorry to disappoint you, however the only workaround at the moment would be to either implement arithmetic checks or retrieve the whole subset using ToList() and do the filtering operation in-memory. 

    I hope this helps. Please do not hesitate to let us know should you face further trouble.  

    Kind regards,
    Serge
    the Telerik team

    Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  3. DevCraft banner
Back to Top