mikependon / RepoDB

A hybrid ORM library for .NET.
Apache License 2.0
1.68k stars 122 forks source link

Question: Getting Error on Merge #837

Open baffourt opened 3 years ago

baffourt commented 3 years ago

I am trying to use the merge command, but I get "Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

I am using the library with .net framework 4.8 web forms project. Reference to System.ComponentModel.Annotations is added, just couldn't get the exact requested reference. I have tried both 5.0.0 and the 4.3.0 but the error above still remains. This is the code:


public static int SaveMarks(List<Quizes> marks)
{
            var connString = ConnString.ConnectionString;
            RepoDb.SqlServerBootstrap.Initialize();
            using (var connection = new SqlConnection(connString))
            {
                return connection.BulkMerge("[tbo].[Quizes]", marks);
            }
}`
mikependon commented 3 years ago

We have the referenced assembly versions below for the latest version of library. Which version of RepoDB did you use?

image

Or, have you tried downgraded to S.C.A version to 4.2.0?

baffourt commented 3 years ago
Screenshot 2021-06-02 at 1 26 18 PM

All the information on the image

We have the referenced assembly versions below for the latest version of library. Which version of RepoDB did you use?

image

Or, have you tried downgraded to S.C.A version to 4.2.0?

Couldn't get the S.C.A version 4.2.0 - it defaults to 4.3.0 even when this version (4.2.0) is specified in package manager

Screenshot 2021-06-02 at 1 38 54 PM

Do I just use RepoDB for BulkOperations?

I added references to RepoDB itself, then RepoDB.SqlServer still same error

Screenshot 2021-06-02 at 1 33 57 PM

Am adding references to the class library project and not the Startup project, does that have any influence since this is very troubling

morraf commented 1 year ago

Hi, I am facing the same problem. I'm using the latest build into into a dll that is not a startup project. Is there a workaround?

mikependon commented 1 year ago

RepoDB is now referencing the version below. Link: https://www.nuget.org/packages/RepoDb#dependencies-body-tab

image

mikependon commented 1 year ago

Is there a blocker for you to upgrade the SCA to 5.0.0?

morraf commented 1 year ago

Hi, first of all thanks for your quickly response! Yes, for me it is a problem because I'm extending an existing a project built on .NET 4.7.1

mikependon commented 1 year ago

I do not think we can downgrade SCA for your case. So, this might be a problem to you using the library. But, if you have the project solution on hand then I guess you can just upgrade the references?

On the hand, we will play around with this use-case and try to see on how can we rectify the problem. The challenge is, we are already hands of on .NET 4.X family, but we will still try.