RFBCodeWorks / DatabaseObjects

Extends the SqlKata library with a set of objects to represents Databases and tables, as well as providing compilers for MSAccess and MS Excel
MIT License
2 stars 0 forks source link

Compatibility issue with Sqlkata 2.4.0 #3

Closed ZoherFesto2 closed 1 year ago

ZoherFesto2 commented 1 year ago

While using the following code:

var compiler = new MSAccessCompiler();
var query = new SqlKata.Query("MainTable").Where("ID",1);
SqlResult result = compiler.compile(query);

it gives MissingMethodException: Method not found: 'Int32 SqlKata.OffsetClause.get_Offset()'.

Works fine with version 2.3.9.

RFBomb commented 1 year ago

Hey thanks for letting me know. I'll have to investigate, as I haven't updated my nuget packages in a while, so I didn't see this.

RFBomb commented 1 year ago

@ZoherFesto2 I copied your code into a new Unit Test and published it on a new branch. The unit test doesn't throw any exceptions. Is there something else in nearby code that may be causing it?

ZoherFesto2 commented 1 year ago

@ZoherFesto2 I copied your code into a new Unit Test and published it on a new branch. The unit test doesn't throw any exceptions. Is there something else in nearby code that may be causing it?

these three lines are the only ones I used. and they throwed the mentioned error. did you reference sqlkata 2.4.0 ? i faced this error in this version.

RFBomb commented 1 year ago

Yes, I updated the branch in question to 2.4. All my unit tests passed, including the new one that has that code in it.

I'm running in Windows 10, with all the MSAccess runtimes installed.

Can you duplicate the issue if you download the branch and run the unit test?

ZoherFesto2 commented 1 year ago

Sorry i closed the issue by mistake:

The branch runs fine with the unit tests. but the error message shows in every single project i create. it seems the branch still have a hidden reference to SqlKata 2.3.9.

In the QueryBuilder/Clauses/OffsetClause.cs I can't find the method get_offset that is giving me the error : MissingMethodException: Method not found: 'Int32 SqlKata.OffsetClause.get_Offset()'.

Please have a look at the sample project WebApplication2.zip

I tested with both windows 10 and 11, both having Access runtime. Both didn't raise any problems with version 2.3.9

ZoherFesto2 commented 1 year ago

Update: In the attached project i deleted the nuget references and used direct references to dlls i built using the branch project. It worked! is there any chance that the nugets on nuget.org are outdated/bugged ones?

RFBomb commented 1 year ago

You were correct, my SqlKata.Extensions was still targeting SqlKata 2.3.2 I've updated the repo and verified it now all targets 2.4.0 on the PR. I've also updated NuGet with packages just now - v1.0.0.6 - that were just built, so all packages should properly require 2.4.0. Can you re-test after grabbing the updated packages?

RFBomb commented 1 year ago

For what its worth, I just downloaded your solution zip, and the issue occurred as it was configured (old packages). I then updated to the v1.0.0.6 packages I published this morning and no exception occurred. Please verify and reopen this thread if its not resolved. Thanks for reporting the issue!

ZoherFesto2 commented 1 year ago

For what its worth, I just downloaded your solution zip, and the issue occurred as it was configured (old packages). I then updated to the v1.0.0.6 packages I published this morning and no exception occurred. Please verify and reopen this thread if its not resolved. Thanks for reporting the issue!

The solution zip contains the following references:

  <ItemGroup>
    <PackageReference Include="RFBCodeWorks.DatabaseObjects" Version="1.0.0.4" />
    <PackageReference Include="RFBCodeWorks.SqlKata.Extensions" Version="1.0.0" />
    <PackageReference Include="RFBCodeWorks.SqlKata.MsOfficeCompilers" Version="1.0.0.1" />
    <PackageReference Include="SqlKata" Version="2.4.0" />
  </ItemGroup>

But it doesn't matter any more. I con confirm the nugets are working. Thank You for this awesome project!